一、Eigen库
sudo apt-get install libeigen3-dev
可用如下语句确认安装成功:
sudo updatedb
locate eigen3
PS:它是一个纯用头文件搭建的库,使用时只需引入Eigen,不需链接库文件。
之后为使用该库,在需要使用该库的工程CMakeLists.txt文件中加入如下语句:
include_directories("/usr/include/eigen3")
二、Kdevelop安装
ppa安装方法:
sudo apt-get update
sudo apt-get install kdevelop
三、Sophus库的安装
按书中教程
git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff(这一步报错)
采用
git clone https://github.com/strasdat/Sophus.git
cd Sophus
mkdir build
cd build
cmake ..
make
之后为使用该库,在CMakeLists.txt中加入如下语句:
find_package( Sophus REQUIRED )
include_directories( ${Sophus_INCLUDE_DIRS}) #添加头文件目录
add_executable( useSophus useSophus.cpp) #添加可执行文件
target_link_libraries( useSophus ${Sophus_LIBRARIES} ) #添加库文件目录
四、Opencv 3.4.0 在Ubuntu16.04.4上的安装
去opencv官网下载/opencv-unix/3.4.0/opencv-3.4.0.zip
https://sourceforge.net/projects/opencvlibrary/
去github上下载安装需要的另一个包opencv_contrib-3.4.0
https://github.com/opencv/opencv_contrib/tree/3.4.0
安装过程参考:https://blog.csdn.net/leaves_joe/article/details/67656340
安装依赖项:
sudo apt-get install python-dev python-opencv python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
sudo apt-get install build-essential cmake git
sudo apt-get install ffmpeg libopencv-dev libgtk-3-dev python-numpy python3-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libv4l-dev libtbb-dev qtbase5-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
解压下载的包
进入解压后的包的目录:
cd opencv-3.4.0/
mkdir build
cd build
配置:
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D INSTALL_C_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules \ -D PYTHON_EXECUTABLE=/usr/bin/python3 \ -D BUILD_EXAMPLES=ON ..
完成后:
make -jx(x是线程数,可以输2,3,4等等)
然后是漫长的等待-----
sudo make install
安装完成
python验证安装:
sudo apt install python3-pip
pip3 install numpy
打开一个新的终端,输入
python3
import cv2 as cv
print(cv.version)
输出 '3.4.0' ,说明python环境正常
五、PCL安装
使用国内源按教材命令容易报错,解决见:
http://www.cnblogs.com/fudong071234/p/6359725.html
教材给出指令:
——————————————————————————————
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all
——————————————————————————————
其中最后一条指令可能报错,执行下列指令:
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl1.7
编译安装见:
http://www.linuxdiyf.com/linux/24123.html
六、Ceres安装
//依赖安装
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3.1.4 libgflags-dev libgoogle-glog-dev libgtest-dev
如果报错检查一下是不是复制以后格式出现问题,书上给的是libcxsparse3.1.2,我的电脑输入1.2会报错.
然后执行:
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
mkdir build
cd build
cmake ..
make
sudo make install