0. 安装Pangolin
依赖项:
sudo apt-get install libglew-dev
sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
sudo apt-get install libdc1394-22-dev libraw1394-dev
sudo apt-get install libjpeg-dev libpng12-dev libtiff5-dev libopenexr-dev
源码编译安装:
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake ..
cmake --build .
sudo make install
卸载ros安装的g2o
sudo apt-get remove ros-kinetic-libg2o
1. 下载源码
git clone https://github.com/gaoxiang12/ORBSLAM2_with_pointcloud_map.git
2. 解压 orbslam2_modified.zip
解压会得到两个文件夹,分别为 g2o_with_orbslam2 和 ORB_SLAM2_modified
3. 编译g2o
安装依赖项
sudo apt-get intall libsuitesparse-dev qtdeclarative5-dev qt5-default libqglviewer-dev
1) 修改 g2o_with_orbslam2/CMakeLists.txt ,注释如下代码:
2)修改 g2o_with_orbslam2/g2o/CMakeLists.txt ,注释如下代码:
3)修改 g2o_with_orbslam2/g2o/types/slam2d/edge_se2_pointxy_bearing.cpp
将
t.setRotation(t.rotation().angle()+_measurement);
改为
t.setRotation((Eigen::Rotation2Dd)(t.rotation().angle()+_measurement));
4)修改g2o_with_orbslam2/g2o/solvers/eigen/linear_solver_eigen.h(注意:eigen3.2.8不用修改此处,以上版本需修改,如3.2.10)
将
typedef Eigen::PermutationMatrix PermutationMatrix;
改为
typedef Eigen::PermutationMatrix PermutationMatrix;
5)编译安装g2o (编译过程中会出现一大堆的warning,还好么有error,万幸万幸啊 如果系统安装的eigen3.2版本,则不会有所谓的警告啦)
cd g2o_with_orbslam2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install
4. 编译DBoW2
cd ORB_SLAM2_modified/Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
编译成功后,会在/lib目录下生成 libDBoW2.so,将该库文件拷贝到系统目录下:
sudo cp ../lib/libDBoW2.so /usr/local/lib
5. 编译 ORB_SLAM2_modified
修改ORB_SLAM2_modified/CMakeLists.txt 中的find_package(OpenCV 2.4.3 REQUIRED) 为 find_package(OpenCV REQUIRED),这样不管你安装的是opencv2 还是opencv3都没问题啦
cd ../../../
mkdir build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
6. 准备 ORBvoc.txt
下载 ORBvoc.txt.tar.gz 并解压到 ORB_SLAM2_modified/Vocabulary 目录下
附百度云链接:https://pan.baidu.com/s/1ckDdhFA9BX4o5Iauf_bdUw
提取码:czrh
也可以去ORBSLAM2的github上下载
7. 准备数据集
下载 rgbd_dataset_freiburg1_desk2 数据集,https://vision.in.tum.de/rgbd/dataset/freiburg1/rgbd_dataset_freiburg1_desk2.tgz,并解压。
8. 运行ORBSLAM2
命令行格式:
命令行格式:
./run/rgbd_tum Vocabulary/ORBvoc.bin path_to_settings path_to_sequence path_to_association
例如将数据集解压到ORB_SLAM2_modified/Examples/RGB-D/目录下时:
../Examples/RGB-D/rgbd_tum ../Vocabulary/ORBvoc.txt ../Examples/RGB-D/TUM1.yaml ../Examples/RGB-D/rgbd_dataset_freiburg1_desk2 ../Examples/RGB-D/associations/fr1_desk2.txt
运行效果如下图所示:
Good Lucky!
参考链接:
https://github.com/gaoxiang12/ORBSLAM2_with_pointcloud_map
https://github.com/abhineet123/ORB_SLAM2
https://blog.csdn.net/oliongs/article/details/79696376