参考连接如:ORB_SLAM3/README.md at master · Mauhing/ORB_SLAM3 · GitHub
一、必要环境sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" sudo apt update sudo apt-get install build-essential sudo apt-get install cmake 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 libdc1394-22-dev libjasper-dev sudo apt-get install libglew-dev libboost-all-dev libssl-dev sudo apt install libeigen3-dev二、安装、编译opencv库到系统中
cd ~ mkdir Dev && cd Dev git clone https://github.com/opencv/opencv.git cd opencv
git checkout 3.2.0(这里其实最后看到orb_slam是要求>4.4.0的opencv,这里我建议把3.2.0改成4.5.0) 其他版本共存问题可以看文章opencvCSDN
Put the following at the top of header file gedit ./modules/videoio/src/cap_ffmpeg_impl.hpp
#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020
and save and close the file
mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D WITH_CUDA=OFF -D CMAKE_INSTALL_PREFIX=/usr/local .. make -j 3(-j的意思是告诉编译器你系统处理器核的个数,可以通过命令nproc查看) sudo make install
(-j的意思是告诉编译器你系统处理器核的个数,可以通过命令nproc查看)
三、安装Pangolincd ~/Dev git clone https://github.com/stevenlovegrove/Pangolin.git cd Pangolin mkdir build cd build cmake .. -D CMAKE_BUILD_TYPE=Release make -j 3 sudo make install
这里git clone这行需要变化(变化如下面连接),Pangolin选择5.0版本(太高版本sorb-lam会编译失败) make -j 安装自己的核数来选择参数
选择下载5.0版本的方法参照https://github.com/stevenlovegrove/Pangolin/issues/769
四、安装ORB-SLAM 3cd ~/Dev git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git cd ORB_SLAM3
We need to change the header file gedit ./include/LoopClosing.h at line 51
from
Eigen::aligned_allocator
to
Eigen::aligned_allocator
Now, we can comiple ORB-SLAM3 and it dependencies as DBoW2 and g2o.
Now Simply just run (if you encounter compiler, try to run the this shell script 2 or 3 more time. It works for me.)
./build.sh
这里可能会遇到点小问题ffmpeg
解决方法就是把cmakelist里关于ffmpeg的注释掉
五、数据集下载数据集(链接: 百度网盘 请输入提取码 密码: 269k)
数据集解压到主目录/Datasets/EuRoc/MH01下
参考连接:安装运行okvis_a7691176的博客-CSDN博客
测试
cd ~/Dev/ORB_SLAM3 # Pick of them below that you want to run # Mono ./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml ~/Datasets/EuRoc/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono # Mono + Inertial ./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml ~/Datasets/EuRoc/MH01 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_monoi # Stereo ./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml ~/Datasets/EuRoc/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereo # Stereo + Inertial ./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml ~/Datasets/EuRoc/MH01 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereoi



