pcl+Qt+vtk配置ubuntu

安装ubuntu必做

常用网站

stackoverflow
百度翻译

ubuntu分区

ubuntu下载地址,启动选择固态硬盘

挂载点 分区大小 分区类型 分区位置 用于 描述
8G×1024MB=8192MB 逻辑分区 空间起始位置 交换空间 相当于windows中的内存条
/ 30G×1024MB=30720MB 主分区 空间起始位置 ext4 相当于windows中的c盘
/home 剩下的67945 逻辑分区 空间起始位置 ext4 用户工作目录,相当于windows下除c盘的其它盘
/boot 500M~1G 逻辑分区 空间起始位置 ext4 存放系统启动时所需的文件
更换阿里源

阿里源地址,为sources.list.bk,替换/etc/sources.list内容
$ sudo apt install mesa-common-dev freeglut3-dev libglfw3-dev libgles2-mesa-dev libglew-dev


将原来的备份
cp  /etc/apt/sources.list   /etc/apt/sources.list.bk
添加阿里源
vim   /etc/apt/sources.list
必要的安装项
编译工具
apt-get install build-essential
chrome
apt-get install chrome-browser
cmake
apt-get install cmake cmake-gui
cloudcompare
sudo snap install cloudcompare
Ubuntu下CloudCompare稳定版本无法打开pcd点云文件,切换到edge版本即可[CloudCompare打开pcd文件](https://blog.csdn.net/u013453604/article/details/87867347)
 sudo snap refresh --edge cloudcompare
 vscode
常用命令
安装程序apt-get锁定,检查代码占用源,输入y杀死该进程
sudo fuser -vik /var/lib/dpkg/lock  
查看已经安装的软件
dpkg   -l   (liblas1.8.1)
查看安装路径
dpkg -L ( liblas1.8.1)
卸载软件
apt remove  liblas1.8.1
查看软件版本
liblas1.8.1  --version

1.安装cmake3.18.0

下载源码cmake-3.18.0-rc3.tar.gz
解压到/opt/cmake3.18.0tar -zxvf cmake-3.18.0-rc3.tar.gz -C /opt
配置path

打开个人path配置
sudo vim  ~/.bashrc
末尾添加
export PATH=/opt/cmake1.8.0/bin:$PATH
配置文件生效
source   ~/.bashrc
查看版本cmake  -version
打开cmake  cmake-gui

vtk依赖Qt,pcl依赖vtk和Qt,所以安装顺序:Qt,vtk,pcl

2.安装Qt

Qt5

下载Qt5.9.8的run文件,修改权限为可执行chmod +x qt,运行./qt.run,安装在/opt/Qt5.9.8目录。
配置path
ubuntu 安装qt,配置环境变量

 vim  ~/.bashrc
插入如下内容:
export QTDIR=/opt/Qt5.9.8/5.9.8
export PATH=$QTDIR/gcc_64/bin:$PATH					(可执行程序qmake等路径)
export LD_LIBRARY_PATH=$QTDIR/gcc_64/lib:$LD_LIBRARY_PATH
 作用于当前用户,不需要重启系统,新打开一个终端即可qmake

参考ubuntu 安装qt,配置环境变量 , CMake qt+pcl+vs 项目常见问题

Qt4

1.安装qt-creator-opensource-linux-x86_64-4.4.1.run到/opt
2.解压qt4源码
a.错误
Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/zhu/Qt/qt-x11-opensource-src-4.5.2/mkspecs/linux-g++

sudo apt-get install libx11-dev
sudo apt-get install libxext-dev
sudo apt-get install libxtst-dev
./configure    o   y
make -j4
check install

Ubuntu下安装QT 4.8.6
ubuntu QT开发环境(三种方法安装Qt4.8,其中apt-get方法安装QT库最简单)

3.安装VTK8.2

下载VTK8.2源码,安装依赖sudo apt-get install freeglut3-dev

用cmake-gui    configure   generate  (Release,/usr/local,  Qt   )
make -j4
checkinstall

(1)CMAKE_BUILD_TYPE:Release(2)CMAKE_INSTALL_PREFIX:/usr/local
(3)VTK_GROUP_QT:/opt/Qt5.14.1/5.14.1/gcc_64/lib/cmake/Qt5

4.安装PCL1.10.0

pcl与可视化库vtk版本对应关系

PCL VTK
pcl-1.7.2 vtk-5.10.1 / vtk-6.2.0
pcl-1.8.1 vtk-7.1.1
pcl-1.9.1/pcl-1.10 vtk-8.2.0

依赖必装boost,eigen3,flann,vtk可选qhull,openni1,openni2

mandatory
sudo apt-get install libboost-all-dev
sudo apt-get install libeigen3-dev
sudo apt-get install  libflann-dev
optional
sudo apt-get install libqhull-dev
sudo apt-get install libopenni-dev  libopenni2-dev

sudo apt-get install git build-essential linux-libc-dev
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common
sudo apt-get install libqhull* libgtest-dev  
sudo apt-get install freeglut3-dev pkg-config  
sudo apt-get install libxmu-dev libxi-dev   
sudo apt-get install mono-complete   

下载PCL源码

用cmake-gui    configure   generate  (Release,/usr/local,  Qt   )
make -j4
checkinstall

步骤与vtk安装类似
(1)选择编译类型CMAKE_BUILD_TYPE:Release
(2)选择安装路径CMAKE_INSTALL_PREFIX:/usr/local
(3)选择Qt目录/opt/Qt5.14.1/5.14.1/gcc_64/lib/cmake/Qt5)
(4)VTK_DIR是不是安装的vtk库的路径
测试PCL:ubuntu16.04 安装pcl1.8.0 , Ubuntu18.04下安装PCL1.9.1

5.安装opencv

必装依赖包:gtk2.0,pkg-config

安装依赖包
 apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
安装可选包
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

OpenCV下载,OpenCV_contrib下载
不选cuda,ffmpeg

opencv2.4.13.6

安装opencv2只需下载opencv源码,无contrib

用cmake	confiure	generate(release,/usr/local,)
make -j4
checkinstall

ubuntu16.04安装opencv2.4.13

opencv3或4

下载opencv,opencv_contrib源码,解压opencv和opencv_contirb,把contrib文件夹移到opencv中
pcl+Qt+vtk配置ubuntu_第1张图片
(1)缺少boostdesc_bgm.i等问题文件下载地址
将下载好的.i文件夹,移植到缺失目录opencv/opencv_contrib/modules/xfeatures2d/src
(2)缺少某hpp文件
将opencv/modules/features2d复制到缺失目录opencv/opencv_contrib/modules/xfeatures2d/test

用cmake  configure  generate  (release  /usr/local  OPENCV_EXTRA_MODULES_PATH=opencv/opencv_contrib/modules )
make -j4
checkinstall

opencv3或4参考在Linux下用正确的姿势安装OpenCV

配置环境变量
1.编辑opencv.conf,它可能为空
sudo vim/etc/ld.so.conf.d/opencv.conf
添加路径
/usr/local/lib
执行生效命令
sudo ldconfig
2.打开~/.bashrc  (/etc/bash.bashrc 亦可)
sudo vim ~/.bashrc
添加路径
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
执行更新命令
source ~/.bashrc
sudo updatedb
测试opencv

opencv内部集成了很多测试demo,可以通过执行这些demo看是否完成opencv的配置。

6.安装liblas

依赖geotiff
(1)下载liblas1.8.1

#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#include
#include
using namespace std;
using namespace boost;
int fun(int x,int y){return x+y;}
int main(){
        int m=1;int n=2;$ sudo apt install mesa-common-dev freeglut3-dev libglfw3-dev libgles2-mesa-dev libglew-dev

        cout<<boost::bind(fun,_1,_2)(m,n)<<endl;
        return 0;
}

(2)命令行。

apt install liblas-dev
apt install liblas-bin
测试
lasinfo trail2.las

7.其他库

boost,eigen3,flann,geotiff,freeglut3

apt-get install libboost-all-dev
apt-get install libeigen3-dev
apt-get install  libflann-dev
apt-get install libgeotiff-dev
apt-get install freeglut3-dev     (包含opengl)

jpeg,png,tiff

apt-get install libjpeg-dev
apt-get install libpng-dev
apt-get install libtiff-dev
GL库
sudo apt install mesa-common-dev freeglut3-dev libglfw3-dev libgles2-mesa-dev libglew-dev

8.checkinstall,deb

ubuntu下从源码制作安装包deb包与更改deb包信息
Linux 的源码安装工具 CheckInstall

9.杂项

Ubuntu16.04/18.04 下PCL1.8.1、opencv4.1.2 的卸载与安装
Ubuntu16.04安装PCL1.8
Compiling PCL from source on Windows
Compiling PCL from source on POSIX compliant sys$ sudo apt install mesa-common-dev freeglut3-dev libglfw3-dev libgles2-mesa-dev libglew-dev
tems

放在project()后
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

ubuntu系统qt+pcl安装及点云显示
PCL+ VTK+QT ubuntu16.04配置 实现可视化点云
ubuntu18.04安装最新cmake3.18

你可能感兴趣的:(pcl+Qt+vtk配置)