This repo is heavily based on:
$ https://github.com/umass-amrl/stereo_dense_reconstructionContinue reading for more information on the original repo.
This is a ROS package for real-time 3D reconstruction from stereo images. Currently this version uses LIBELAS for generating dense disparity maps as a baseline. The method for generation of disparity maps can be changed based on user preferences.
This package serves as a visualization tool for dense disparity maps and point clouds. Additionally, a tool for transforming point clouds to a different reference frame is also included.
Usually, the point clouds are formed in the reference frame of the left camera. For ground robots, often the point clouds need to be transformed to a different frame e.g., a reference frame with the origin at the centre of rotation of the robot projected on to the ground plane. These transformations are hard to calculate mathematically - this tool can be used to find the transformations visually.
- Author: Sourish Ghosh
A calibrated pair of cameras is required for stereo rectification and calibration files should be stored in a .yml file.
This repository contains all the tools and instructions to calibrate stereo cameras.
The rotation and translation matrices for the point cloud transformation should be named as XR and XT in the calibration file. XR should be a 3 x 3
matrix and XT should be a 3 x 1 matrix. Please see a sample calibration file in the calibration/ folder.
Clone the repository:
$ git clone https://github.com/umass-amrl/stereo_dense_reconstructionFor compiling the ROS package, rosbuild is used. Add the path of the ROS package to ROS_PACKAGE_PATH and put the following line in your .bashrc file.
Replace PATH by the actual path where you have cloned the repository:
$ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/PATHExecute the build.sh script:
$ cd stereo_dense_reconstruction
$ chmod +x build.sh
$ ./build.sh$ ./bin/dense_reconstruction [OPTION...]Usage: dense_reconstruction [OPTION...]
-l, --left_topic=STR Left image topic name
-r, --right_topic=STR Right image topic name
-c, --calib_file=STR Stereo calibration file name
-w, --calib_width=NUM Calibration image width
-h, --calib_height=NUM Calibration image height
-u, --out_width=NUM Rectified image width
-v, --out_height=NUM Rectified image height
-d, --debug=NUM Set d=1 for cam to robot frame calibrationThis node outputs the dense disparity map as a grayscale image on the topic /camera/left/disparity_map and the corresponding point cloud on the topic
/camera/left/point_cloud.
A sample dataset can be found here.
The point cloud can be viewed on rviz by running:
$ rosrun rviz rvizTo transform the point cloud to a different reference frame, the XR and XT matrices (rotation and translation) in the calibration file need to be changed.
This can be done real-time by the running:
$ rosrun rqt_reconfigure rqt_reconfigureIf you change the Euler Angles in rqt_reconfigure you should be able to see the point cloud transform. Don't forget to set d=1 when running the
dense_reconstruction node. This prints out the new transformation matrices as you transform the point cloud.
This software is released under the GNU GPL v3 license.