跳到主要内容
版本:9.2.0

立方体视频融合

加载三维视频融合图层,支持立方体视频融合。

show
<!DOCTYPE html>
<html>

<head>
<title>立方体视频融合</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
}

</style>
<script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.2.0/mapmost-webgl-min.js"></script>
</head>

<body>
<div id='map'></div>
<script>

const map = new mapmost.Map({
container: 'map',
style: '<your style url>',
center: [120.681049691001206, 31.321349947429418],
zoom: 20.5,
pitch: 30,
bearing: 12,
userId: '***', // 授权码
env3D: {
envMap: './static/WhiteBG_Ref_1K.hdr',
exposure: 1.8,
defaultLights: false,
}
});

map.on('load', () => {
map.addLayer({
id: 'model_layer',
type: 'model',
models: [{
type: 'glb',
url: './static/house1.glb'
}],
project: "3857",
center: [120.681049691001206, 31.321349947429418, 0.0],
});

addBoxVideoLayer();
})

function addBoxVideoLayer() {
let options = {
id: 'box-video-layer',
type: 'boxVideo',
center: [120.68152338516848, 31.321349947429432, 0.5],
cameraData: {
videoUrl: './static/175.mp4',
videoType: 0, // 视频源格式,必填
cameraModel: 1, // 0---无畸变纠正,1---鱼眼畸变纠正,12---除法模型畸变纠正
width: 2560, // 视频宽度,必填
height: 1920, // 视频高度,必填
fx: 511.28906240553897,
fy: 509.2086566536431,
u0: 1284.0372612568253,
v0: 959.0415832165829,
k1: 0.18428408682396316,
k2: -0.10387142960869065,
k3: 0.06083848190005854,
k4: -0.013071638867916777,
fScale: 0.5,
boxDivision: {
front: {
visible: true, // 是否可见
maskBox: [0, 1.0, 0, 0.6], // 平面区域裁剪[xMin, xMax, yMin, yMax]
verticalFactor: 2, // 视频纵向拉伸比例
anchorPoints: [[926, 622], [1635, 620], [2141, 179], [402, 123]], // 图像角点
},
right: {
visible: true,
maskBox: [0, 1, 0, 0.6],
verticalFactor: 2,
anchorPoints: [[1635, 620], [1628, 1287], [2144, 1766], [2141, 179]],
},
back: {
visible: true,
maskBox: [0, 1, 0, 0.6],
verticalFactor: 2,
anchorPoints: [[1628, 1287], [922, 1286], [382, 1782], [2144, 1766]],
},
left: {
visible: true,
maskBox: [0, 1, 0, 0.6],
verticalFactor: 2,
anchorPoints: [[922, 1286], [926, 622], [402, 123], [382, 1782]],
},
bottom: {
visible: true,
maskBox: [0, 1, 0, 1],
verticalFactor: 1,
anchorPoints: [[922, 1286], [1628, 1287], [1635, 620], [926, 622]],
}
}
}
}
map.addLayer(options);
}

</script>
</body>
</html>