Potree在web端显示大型点云模型文件

一、克隆项目代码(准备好上网工具,得先有node.js npm 环境)

复制代码
git clone https://github.com/potree/potree.git

二、依赖安装(换淘宝镜像能快一些)

复制代码
cd potree
npm install

三、运行

复制代码
npm start

四、使用样例

打开浏览器,输入http://localhost:1234/,即可看到 Potree 的界面。

打开任意examples下的html查看模型

五、换成自己的点云模型

将地址中的cloud.js换成自己模型的地址。

复制代码
// Load and add point cloud to scene
		Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/360/MLS_drive1/cloud.js", "MLS", e => {
			let scene = viewer.scene;
			let pointcloud = e.pointcloud;
			
			let material = pointcloud.material;
			material.size = 0.5;
			material.minSize = 2.0;
			material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
			material.shape = Potree.PointShape.SQUARE;
			material.activeAttributeName = "rgba";
			
			scene.addPointCloud(pointcloud);

			viewer.scene.view.setView(
				[2652381.103, 1249049.447, 411.636],
				[2652364.407, 1249077.205, 399.696],
			);

			run();
		});

		async function run(){

			proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
			proj4.defs("pointcloud", viewer.getProjection());
			let transform = proj4("WGS84", "pointcloud");

			let params = {
				transform: transform
			};

Potree加载的点云格式为OCTree格式的数据结构,无法直接加载格式为LAS,LCD,PLY等格式的点云文件,所以我们需要通过PotreeConverter来将普通的点云格式文件转换为OCtree格式的点云文件。去github下载PotreeConverter对模型文件进行格式转换,只能转换las格式的文件。

复制代码
https://github.com/potree/PotreeConverter
1.7版本可用

win系统下载目录执行如下样例指令

复制代码
PotreeConverter.exe D:\\test.las -o D:\\output

linux系统,可加上版本新版本不好用

复制代码
git clone https://github.com/potree/PotreeConverter.git
cd PotreeConverter
mkdir build && cd build
cmake ..
make

完成以后执行
PotreeConverter /home/yr/test.las -o /home/yr/output
即可得到模型

转换后的文件结构

换成自己的点云后的效果图

相关推荐
zl_vslam17 小时前
SLAM中的非线性优-3D图优化之绝对位姿SE3约束四元数形式(十九)
人工智能·算法·计算机视觉·3d
Patrick_Wilson17 小时前
你删过 lock 文件吗?聊聊包管理器迁移中 90% 的人会踩的坑
javascript·npm·前端工程化
早點睡39017 小时前
ReactNative项目OpenHarmony三方库集成实战:react-native-permissions
javascript·react native·react.js
氢灵子17 小时前
Fixed 定位的失效问题
前端·javascript·css
英俊潇洒美少年17 小时前
函数组件(Hooks)的 **10 大优点**
开发语言·javascript·react.js
Yao.Li17 小时前
LINEMOD BOP 转 PVN3D 测试实操指南
3d
方安乐17 小时前
Javascript工具库:classnames
开发语言·javascript·ecmascript
labixiong17 小时前
React Hooks 闭包陷阱:高级场景与深度思考
前端·javascript·react.js
颜酱17 小时前
回溯算法专项突破练习(1)
javascript·后端·算法
掘金者阿豪18 小时前
在AI时代,没有人是“只写一行代码的人”——我们为何都在被迫成为全栈?
vue.js·后端