Linux中potree的环境配置及点云可视化

首先确认电脑是否已装nodejs和gulp,若已装,跳到第三步

一 安装nodejs

sudo apt-get install nodejs
sudo apt-get install npm
#验证是否安装成功命令
node -v

二 安装gulp

sudo npm install -g gulp
#验证是否安装成功命令
gulp -v

三 安装potree

在终端依次输入以下命令:

git clone https://github.com/potree/potree
cd Potree      #安装目录
npm install
npm install -g gulp
gulp watch

此时Potree的安装目录下应当有了一个build的文件夹。

四 PotreeConverter安装

Potree可视化数据需要使用具备Potree它定义的格式的数据,因此需要对txt、las等数据使用PotreeConverter转换格式

4.1 LAStools安装

1、输入命令:git clone https://github.com/LAStools/LAStools
2、在终端依次输入以下命令:
cd ~/laz/lastools   #自己创建的文件夹laz
git clone https://github.com/m-schuetz/LAStools.git master
cd master/LASzip
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

这就配置好PotreeConverter所需要的LAStool依赖了

4.2 PotreeConverter

终端输入以下命令:
cd ~/laz/PotreeConverter
git clone https://github.com/potree/PotreeConverter.git master
cd master
mkdir build
cd build
cmake ../
make

此过程若出现TBB.camke类错误,可源码安装tbb(必须源码安装,不能使用apt-get install libtbb-dev,这样安装的库最后在编译链接PotreeConverter时会链接出错),
安装过程如下:

sudo apt install build-essential
sudo git clone https://github.com/wjakob/tbb.git
cd tbb/build
sudo cmake ..
sudo make -j  #若编译过程出现系统卡住,速度过慢等,可增大ubuntu系统分配内存,并将命令改成sudo make -j4
sudo make install

五 数据转换

几种转换方法

# convert data.las and generate web page.
./PotreeConverter.exe C:/data.las -o C:/potree_converted -p pageName
 
# generate compressed LAZ files instead of the default BIN format.
./PotreeConverter.exe C:/data.las -o C:/potree_converted --output-format LAZ
 
# convert all files inside the data directory
./PotreeConverter.exe C:/data -o C:/potree_converted
 
# first, convert with custom bounding box and then append new_data.las afterwards.
# points in new_data MUST fit into bounding box!
./PotreeConverter.exe C:/data -o C:/potree_converted -aabb "-0.748 -2.780 2.547 3.899 1.867 7.195"
./PotreeConverter.exe C:/new_data.las -o C:/potree_converted --incremental
 
# tell the converter that coordinates are in a UTM zone 10N projection. Also, create output in LAZ format
./PotreeConverter.exe C:/data -o C:/potree_converted -p pageName --projection "+proj=utm +zone=10 +ellps=GRS80 +datum=NAD83 +units=m +no_defs" --overwrite --output-format LAZ
 
# using a swiss projection. Use http://spatialreference.org/ to find projections in proj4 format
./PotreeConverter.exe C:/data -o C:/potree_converted -p pageName --projection "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.4,15.1,405.3,0,0,0,0 +units=m +no_defs" --overwrite

六 potree点云可视化

##In Potree, modify one of the examples with following load command:

let url = "../pointclouds/D/temp/test/metadata.json";
Potree.loadPointCloud(url).then(e => {
	let pointcloud = e.pointcloud;
	let material = pointcloud.material;

	material.activeAttributeName = "rgba";
	material.minSize = 2;
	material.pointSizeType = Potree.PointSizeType.ADAPTIVE;

	viewer.scene.addPointCloud(pointcloud);
	viewer.fitToScreen();
});

① 在potree目录下运行npm start
② 打开链接http://localhost:1234/examples/,即可看到examples中的文件,点击打开即可。
在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值