rgbd-slam-practice

Overview

This project is related to RGB-D SLAM (Simultaneous Localization And Mapping). It is only a small practice for me to go through the entire pipeline of keypoint-based visual SLAM and to pick up my C++ programming. The code largely depends on this tutorial.

Prerequisite

  • g2o: I encountered several problems with this library and I have modified it a bit. The one works well is in 3rdparty/ directory. What I've done in my uploaded g2o package are,
$ git clone -b c++03 https://github.com/felixendres/g2o.git
  # add “add_compile_options(-std=c++11)” to CMakeLists.txt
$ cd g2o
$ mkdir build && cd build
$ cmake .. -DG2O_BUILD_EXAMPLES=OFF
$ make -j4
  • PCL: For Ubuntu 16.04, you can directly install it using sudo apt-get install libpcl-dev pcl-tools. Otherwise, you can build it from source.
  • OpenCV: Remember to check the version being used in CMakeLists.txt.

How to Run

Build the code,

$ cd ${RGBD-SLAM-PRACTICE-ROOT_DIR}/build
$ cmake ..
$ make

A set of RGB and depth images are required for RBGD-SLAM. Normally, a pair of RGB and depth images should have the same name but are placed in ./data/rgb_img and ./data/depth_img directories resepectively. The images in a directory will be read in numerical order of the filenames. There are several adjustable parameters specified in parameters.txt. Run the code,

$ cd ${RGBD-SLAM-PRACTICE-ROOT_DIR}
$ ./bin/slam ./parameter.txt
$ pcl_viewer ./results/result.pcd # other outputs are also in ./results/ directory

Results

Using data provided by the tutorial, we can construct 3D model in point cloud like,

Notes

  • If you are using other detector or descriptor like SIFT or SURF, you need to compile OpenCV with nonfree package.
  • For Ubuntu 16.04, g2o_viewer is broken (*** Error in `g2o_viewer`: realloc(): invalid pointer: 0x00007fe7d3d0c820 ***), at least on my computer.
  • There is a mysterious segmentation fault at the end of the slam program and it may be related to g2o package I guess.

Reference