ORB-SLAM3 安装过程

ORB-SLAM3 安装过程

0 环境

ubuntu 18.04

1下载源码

https://github.com/UZ-SLAMLab/ORB_SLAM3

2 第三方库安装

2.1 安装Pangolin

2.1.1 下载安装包

git clone https://github.com/stevenlovegrove/Pangolin.git

2.1.2 安装依赖(Required Dependencies):

C++11(编译器要有对这个特性的支持)
安装依赖Glew: sudo apt-get install libglew-dev
安装Cmake:sudo apt-get install cmake (一般这个都会有,有的话就不用安装了)
(建议的依赖)Recommended Dependencies:
  安装Python2/Python3(for drop-down interactive console):

sudo apt-get install libpython2.7-dev
如果还有其他的需求,可以参考REANDEME.txt文档中对应依赖的安装。

2.1.3 编译安装Pangolin:

cd [path-to-pangolin(Pangolin路径)]//打开解压后的Pangolin文件夹
mkdir build
cd build
cmake ..
make(或者用cmake --build .)
sudo make install (.h默认安装到了/usr/local/include)

安装过程可能会出现的问题以及解决办法:http://blog.csdn.net/u012986684/article/details/52860849

2.2 安装opencv

2.2.1 开始安装

cd opencv-3.3.11
mkdir release

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv3 -DOPENCV_EXTRA_MODULES_PATH=**/home/finer/WORKSPACE/SLAM/thirdparty/opencv-3.4.11/opencv_contrib-3.4.11/modules** -DWITH_TBB=ON -DWITH_QT=ON -DWITH_GTK=ON -DWITH_CUDA=ON -DWITH_CUBLAS=ON -DWITH_CUFFT=ON -DWITH_V4L=ON -DWITH_LIBV4L=ON -DWITH_OPENGL=ON -DWITH_FFMPEG=ON -DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON -DINSTALL_C_EXAMPLES=ON -DCUDA_GENERATION=Auto -DCUDA_ARCH_BIN=7.5 -DCUDA_ARCH_PTX=7.5 -DPYTHON_EXECUTABLE=/usr/bin/python -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python2.7 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so -DPYTHON_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include/ ..

sudo make -j4
sudo make  install

2.2.2 问题解决

  • OpenCv依赖包libjasper-dev出现unable to locate libjasper-dev的解决办法

sudo add-apt-repository “deb http://security.ubuntu.com/ubuntu xenial-security main”
sudo apt update
sudo apt install libjasper1 libjasper-dev

  • error:change source address
    Couldn’t find any package by glob ‘libgstreamer0.10-dev’
    E: Couldn’t find any package by regex ‘libgstreamer0.10-dev’
    E: Unable to locate package libgstreamer-plugins-base0.10-dev
    E: Couldn’t find any package by glob ‘libgstreamer-plugins-base0.10-dev’
    E: Couldn’t find any package by regex ‘libgstreamer-plugins-base0.10-dev’
    解决方案:
    1)wget http://ftp.ca.debian.org/debian/pool/main/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5_amd64.deb

2)wget http://ftp.ca.debian.org/debian/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb

3)sudo dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb

4)sudo dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb

python3支持
sudo apt install python3-dev python3-numpy
streamer支持
sudo apt install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
可选的依赖
sudo apt install libpng-dev libopenexr-dev libtiff-dev libwebp-dev

  • Ubuntu系统opencv编译错误:Makefile:162:recipe for target ‘all‘ failed make:*** [all] Error 2

主要是2个位置的文件下载有问题:
①opencv/.cache/xfeatures2d/boostdesc
②opencv/.cache/xfeatures2d/vgg
cd到对应文件夹下,里面的文件是0K,然后用下载好的文件覆盖即可。
在https://github.com/opencv/opencv_contrib/issues/1301中寻找leaf918用户,他提供了patch_.zip文件

cd xxx/opencv-3.4.11/.cache/xfeatures2d

rm -rf  *  (删除boostdesc vgg 文件夹)

unzip patch__.zip

2.3 安装Eigen3

Eigen是一个C++开源线性代数库。它提供了快速的有关矩阵的线性代数运算及求解方程等功能。

git clone https://github.com/eigenteam/eigen-git-mirror

#安装
cd eigen-git-mirror
mkdir build
cd build
cmake ..
sudo make install

2.4 DBoW2 and g2o

DBoW2主要用于回环检测,g2o(General Graph Optimization)主要用于图优化。
ORB-SLAM3的源码包自带DBoW2 and g2o,编译时会自动安装。

2.5 安装boost库

到boost官网安装一个boost库的压缩包,我下的是1.69.0版本
https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz

*执行下面的命令解压
tar -xzvf boost_1_69_0.tar.gz
解压出来以后,进入解压出来的文件夹,执行下面的命令
sudo ./bootstrap.sh
sudo ./b2 install
文件默认安装在/usr/local/include文件下,库文件默认安装在/usr/local/lib下

3 运行ORB-SLAM3

3.1 编译

cd ORB-SLAM3/
chmod +x build.sh
sudo ./build.sh

3.2 测试数据集下载

双目测试数据的下载地址:

https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets

找到Downloads下面的data链接,下载一个ASL格式的序列(例如:Machine Hall 01)

3.3 测试

./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml $dateSet/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono

将上面指令 $dateSet/MH01改成自己数据集的路径,Enjoy~

上一篇:在Centos7下安装Mysql源码编译安装5.7版本


下一篇:shell脚本安装mysql5.6