Capture your own dataset#

If you have a RealSense camera, capturing RGBD frames is easy by using sensors/realsense_recorder.py.

Note

This tutorial assumes that valid RealSense Python package and OpenCV Python package are installed in your environment. Please follow this instruction to install RealSense Python package.

Input arguments#

The script runs with one of the following three options:

python realsense_recorder.py --record_imgs
python realsense_recorder.py --record_rosbag
python realsense_recorder.py --playback_rosbag

In either record_imgs and record_rosbag mode, the script displays the following capturing preview.

../../_images/recorder.png

The left side shows color image with invalid depth region markup (in gray color), and the right side shows jet color coded depth map. Invalid depth pixels are object boundary, uncertain region, or distant region (more than 3m). Capturing frames without too many gray pixels is recommended for the good reconstruction quality.

By default, record_imgs mode saves aligned color and depth images in dataset/realsense folder that can be used for reconstruction system.

dataset
└── realsense
    ├── camera_intrinsic.json
    ├── color
       ├── 000000.jpg
       ├── :
    └── depth
        ├── 000000.png
        ├── :
camera_intrinsic.json has intrinsic parameter of the used RealSense camera.

This parameter set should be used with the dataset.

Make a new configuration file#

A new configuration file is required to specify path to the new dataset. config/realsense.json is provided for this purpose.

 1{
 2    "name": "Realsense bag file",
 3    "path_dataset": "dataset/realsense.bag",
 4    "path_intrinsic": "optional/read_from_bag_file.json",
 5    "depth_max": 3.0,
 6    "voxel_size": 0.05,
 7    "depth_diff_max": 0.07,
 8    "preference_loop_closure_odometry": 0.1,
 9    "preference_loop_closure_registration": 5.0,
10    "tsdf_cubic_size": 3.0,
11    "icp_method": "color",
12    "global_registration": "ransac",
13    "python_multi_threading": true
14}

Note that path_dataset and path_intrinsic indicates paths of dataset and intrinsic parameters.

Run reconstruction system#

Run the system by using the new configuration file.

cd examples/python/reconstruction_system/
python run_system.py config/realsense.json [--make] [--register] [--refine] [--integrate]