安装PCL OPENNI

1.通过apt-get安装

sudoadd-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl

sudo apt-get update

sudoapt-get install libpcl-all

连不上,……

2.通过源码安装

2.1 安装依赖项

sudo apt-get installg++

sudo apt-get installcmake cmake-gui

sudo apt-get installdoxygen 

sudo apt-get installmpi-default-dev openmpi-bin openmpi-common 

sudo apt-get installlibflann1 libflann-dev

sudo apt-get installlibeigen3-dev

sudo apt-get installlibboost-all-dev

sudo apt-get installlibvtk5.8-qt4 libvtk5.8libvtk5-dev

sudo apt-get installlibqhull*

sudo apt-get installlibusb-dev

sudo apt-get installlibgtest-dev

sudo apt-get installgit-core freeglut3-dev pkg-config

sudo apt-get installbuild-essential libxmu-dev libxi-dev

sudo apt-get installlibusb-1.0-0-dev graphviz mono-complete

sudo apt-get installqt-sdk openjdk-7-jdk openjdk-7-jre

sudo apt-get installphonon-backend-gstreamer

sudo apt-get installphonon-backend-vlc 

安装libflann1时出现问题,仓库里没有了,百度搜索,找到了deb

sudo dpkg -i libflann1.7_1.7.1-4_amd64.deb

按上了,希望是好使的,不会有什么问题,

so ……继续安装其他依赖项,终于安完了依赖项,其中只有libflann1没找到,其他在仓库里都找到了

话说16.04公有库里提供了PCL,可能会好使一些。 

2.2  下载PCL源码文件

$git clonehttps://github.com/PointCloudLibrary/pcl.git pcl-trunk ln -s pcl-trunk pcl(我是直接下载了压缩包,解压的,不然太慢了)

$mkdir release

$cd release

$cmake-DCMAKE_BUILD_TYPE=None -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON ..

$make -j4 (四线程编译,CPU没有四线程的就不要j4了)

$sudo make install 

make的时候出现了这样一些东西

/home/zq/slam/ch5/pcl-trunk/common/include/pcl/sse.h:87:6:warning: the mangled name of ‘__m128 pcl::sse_cmpgt(__m128, __m128)’ willchange in a future version of GCC [-Wabi]

 RETfsse_cmpgt( const __m128 x, const __m128 y ) { return _mm_cmpgt_ps(x,y); }

     ^

/home/zq/slam/ch5/pcl-trunk/common/include/pcl/sse.h:88:6:warning: the mangled name of ‘__m128i pcl::sse_cmpgt(__m128i, __m128i)’ willchange in a future version of GCC [-Wabi]

 RETisse_cmpgt( const __m128i x, const __m128i y ) { return _mm_cmpgt_epi32(x,y); }

     ^

又出问题了,编译停止

 #include

                         ^

compilation terminated.

make[2]: ***[apps/CMakeFiles/pcl_openni_passthrough.dir/include/pcl/apps/moc_openni_passthrough.cpp.o]Error 1

make[1]: ***[apps/CMakeFiles/pcl_openni_passthrough.dir/all] Error 2

make[1]: *** Waiting for unfinished jobs....

Linking CXX executable../bin/pcl_openni_shift_to_depth_conversion

Linking CXX shared library../../lib/libpcl_gpu_kinfu_large_scale.so

[ 56%] Built targetpcl_openni_shift_to_depth_conversion

[ 56%] Built targetpcl_gpu_kinfu_large_scale

Linking CXX executable../bin/pcl_openni_voxel_grid

[ 56%] Built target pcl_openni_voxel_grid

make: *** [all] Error 2 

看来PCL还依赖OPENI,那就先安装OPENI

网上教程:

二、openni2.0

1.安装 OpenNI2依赖项

1

2

$sudo apt-get install -y g++ python libusb-1.0-0-dev freeglut3-dev doxygen graphviz

$sudo apt-get install libudev-dev

2.githubopenni2源码clone下来

1

2

$git clone https://github.com/occipital/OpenNI2.git

$cd OpenNI2

Building OpenNI:

                1) Go into the directory:"Platform/Linux-x86/CreateRedist".

                   Run the script:"./RedistMaker".

                   This will compile everythingand create a redist package in the "Platform/Linux-x86/Redist"directory.

                   It will also create adistribution in the "Platform/Linux-x86/CreateRedist/Final"directory.

                2) Go into the directory:"Platform/Linux-x86/Redist".

                   Run the script: "sudo./install.sh" (needs to run as root) 

                   The install script copieskey files to the following location:

                       Libs into: /usr/lib

                       Bins into: /usr/bin

                       Includes into:/usr/include/ni

                       Config files into:/var/lib/ni

github上有官方安装、依赖项及编译说明。

安装完成,继续make  PCL ,出错了

sthrough.cpp:9:

/usr/include/vtk-5.8/QVTKWidget.h:40:25: fatal error: QtGui/QWidget:No such file or directory

 #include

                         ^

compilation terminated.

Linking CXX executable ../bin/pcl_openni_organized_edge_detection

make[2]: ***[apps/CMakeFiles/pcl_openni_passthrough.dir/include/pcl/apps/moc_openni_passthrough.cpp.o]Error 1

make[1]: *** [apps/CMakeFiles/pcl_openni_passthrough.dir/all] Error2

make[1]: *** Waiting for unfinished jobs....

[ 66%] Built target pcl_openni_octree_compression

[ 66%] Built target pcl_openni_organized_edge_detection

Linking CXX executable ../bin/pcl_openni_shift_to_depth_conversion

[ 66%] Built target pcl_openni_shift_to_depth_conversion

make: *** [all] Error 2

原因是qt4 QtGui.h头文件是这么定义的 Qt::WindowFlags window_flags;

但是 QVTKWidget.h   87行是这么使用的 Qt::WFlags f=0);

所以解决办法,如果不想换vtk5.8,可以修改一下WFlags。亲测有效。

cd /usr/include/vtk-5.8$ sudo vim QVTKWidget.h

如果编译器找不到头文件,可以尝试修改#include #include

安装完成。

你可能感兴趣的:(视觉SLAM)