CloudCompare是一个三维点云(网格)编辑和处理软件。最初,它被设计用来对稠密的三维点云进行直接比较。它依赖于一种特定的八叉树结构,在进行点云对比这类任务时具有出色的性能。最近工作上需要使用CloudCompare来标注点云数据,因此记录一下在Ubuntu20.04下使用源码编译CloudCompare的过程。
首先确定是否安装了OpenGL
linux下查看OpenGL版本命令:
$ glxinfo | grep OpenGL
如果已经安装,显示的内容类似于:
需要查看QT的版本:
$ qmake -v
其次要确认是否安装了下面的包
libqt5svg5-dev
libqt5opengl5-dev
qt5-default
qttools5-dev
qttools5-dev-tools
libqt5websockets5-dev
查询命令:
$ dpkg -l | grep libqt5svg5-dev
如果安装了则显示:
如果未安装,那么安装方法如下:
# usage: Run update command to update package repositories and get latest package information.
$ sudo apt-get update -y
# usage: run the install command with -y flag to quickly install the packages and dependencies
$ sudo apt-get update -y libqt5svg5-dev libqt5opengl5-dev qt5-default qttools5-dev qttools5-dev-tools libqt5websockets5-dev
接下来把repo clone到本地
$ git clone --recursive GitHub - CloudCompare/CloudCompare: CloudCompare main repository
CloudCompare的github网站上介绍Linux下不用单独设置CMAKE_PREFIX_PATH告诉CMake Qt安装在哪个位置,它会自动识别
"When doing a basic build of CloudCompare, the only CMake arguments that is required is the CMAKE_PREFIX_PATH to tell CMake where to find your Qt installation. On Linux Qt is installed in a standard location that CMake will find."
但是可以设置CMAKE_INSTALL_PREFIX去设置CloudCompare的安装路径
"You can also use the CMAKE_INSTALL_PREFIX to customize the path where CloudCompare will be installed."
进入clone到本地的CloudCompare文件夹内
$ cd CloudCompare
$ mkdir build && cd build
$ cmake .. -DPLUGIN_STANDARD_QPCL=ON(需要额外添加 ,否则cloud compare 无法读取.pcd文件)
$ cmake --build .
$ cmake --install .
接下来进入CloudCompare的安装路径,启动CloudCompare
$ cd /usr/local/bin (默认安装路径)
$ cloudcompare
或者为了方便可以设置软链接
$ ln -s /usr/local/bin/cloudcompare {YOUR_PATH}/cloudcompare
最终界面如下图:(自己编译的时候可以根据需要选择多种插件,我编译的基本没选择其余的插件)
之前使用网上推荐的snap/flatpak 方法在Linux下进行CloudCompare的安装,我用的是flatpak的方法,但是安装好以后使用CloudCompare导出.txt时,总是保存成.bin文件,不知道哪里出了问题。因此尝试使用源码编译,这种情况下CloudCompare可以正常导出.txt文件。
下面附上使用flatpak在Ubuntu20.04下安装CloudCompare的命令(我当时安装完毕后需要重启一下机器才可以显示CC的图标)