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
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
    "name": "Captured frames using Realsense",
    "path_dataset": "dataset/realsense/",
    "path_intrinsic": "dataset/realsense/camera_intrinsic.json",
    "max_depth": 3.0,
    "voxel_size": 0.05,
    "max_depth_diff": 0.07,
    "preference_loop_closure_odometry": 0.1,
    "preference_loop_closure_registration": 5.0,
    "tsdf_cubic_size": 3.0,
    "icp_method": "color",
    "global_registration": "ransac",
    "python_multi_threading": true
}

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]