ORB-SLAM 3 工程跑通

参考连接如: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 4.5.0
原文是:git checkout 3.2.0
这里改成:git checkout 4.5.0
(这里其实最后看到orb_slam是要求>4.4.0的opencv,这里我建议把3.2.0改成4.5.0) 其他版本共存问题可以看文章多版本opencv共存(1条消息) Opencv c版本安装,持续更新其使用方法_苏歆_sssuxin的博客-CSDN博客

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查看)(这里不建议把核数选满,cpu占用过大导致系统无法进行其他操作)

三、安装Pangolin

cd ~/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 3

cd ~/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<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
to
Eigen::aligned_allocator<std::pair<KeyFrame *const, g2o::Sim3> > > KeyFrameAndPose; in order to make this comiple.
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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值