操作系统:Ubuntu20.04
1.安装Eigen3
推荐大家安装版本 3.2.10
链接:https://eigen.tuxfamily.org/index.php?title=Main_Page
mkdir build
cd build
cmake ..
sudo make install
2.安装Pangolin
推荐安装0.5版本
链接:https://github.com/stevenlovegrove/Pangolin/releases/tag/v0.5
先安装两个必要依赖:
sudo apt install pkg-config python3-pip
sudo apt install libglew-dev
推荐依赖:python2、用于python和C++互相调用所需的库pybind11、图形库Pillow等其他python模块、Linux 新型显示服务架构Wayland
sudo apt install libpython2.7-dev
git submodule init && git submodule update
sudo python -mpip install numpy pyopengl Pillow pybind11
sudo apt install pkg-config
sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols
3.安装ceres-solver
推荐安装2.2.0
链接:https://github.com/ceres-solver/ceres-solver/tags
4.安装opencv3
推荐安装3.4.16版本
地址:https://opencv.org/releases/
下载完成后,将其提取到主目录。将该文件夹重命名为opencv3。
(1)安装依赖环境
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config
(2)编译
cd opencv3
mkdir build
cd build
sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j4
(3)安装
sudo make install
(4)环境配置
修改ld.so.conf文件
用gedit打开/etc/ld.so.conf
在文件中加上一行 /usr/loacal/lib
其中/user/loacal是opencv安装路径也就是makefile中指定的安装路径
sudo gedit /etc/ld.so.conf
(5)运行下面语句刷新库链接配置
sudo ldconfig
(6)修改bash.bashrc文件
终端执行:
sudo gedit /etc/bash.bashrc
在文件末尾加入:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
(6)刷新配置文件
source /etc/bash.bashrc
(7)检查是否安装成功
pkg-config opencv --modversion
1.opencv 出问题解决
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow'
如何解决链接:https://blog.csdn.net/Zoey_chn/article/details/137687229
5.安装g2o
链接:https://github.com/RainerKuemmerle/g2o
mkdir build && cd build
cmake ..
make
sudo make install
6.安装 DBoW3
7.安装ORB_SLAM 2
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh
安装遇到的常见问题及解决方法
https://blog.csdn.net/wakeup_high/article/details/138011781?spm=1001.2014.3001.5502
8.运行ORB-SLAM2
1.单目
KITTI数据集
./Examples/Stereo/stereo_kitti Vocabulary/ORBvoc.txt Examples/Stereo/KITTI00-02.yaml /home/wm/Downloads/slam_data/KITTI/sequences/00/
TUM 数据集
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/wm/Downloads/slam_data/rgbd_dataset_freiburg1_xyz
2双目
KITTI数据集
./Examples/Stereo/stereo_kitti Vocabulary/ORBvoc.txt Examples/Stereo/KITTI00-02.yaml /home/wm/Downloads/slam_data/KITTI/sequences/00/
3.RGB-D
TUM数据集
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/wm/Downloads/slam_data/rgbd_dataset_freiburg1_xyz /home/wm/Downloads/ORB_SLAM2/Examples/RGB-D/associations/fr1_desk.txt