The Easy Depth Calibration procedure usually takes only a few minutes by following the steps described below. Here, we assume an off-line calibration phase, but these steps can be easily automated on a mobile robot and run on-line.
1. Acquire a data set
Use your preferred set-up to acquire a ROS bag with depth data from your RGBD sensor. They are usually recorded in the topics:
/camera/depth/image_raw
/camera/depth/camera_info
Example:
$ rosbag record /camera/depth/image_raw /camera/depth/camera_info
If you want to test the calibration procedure with one of our data sets, please download one from the Data sets section
Check the video to see an actual calibration procedure using an XTION camera
Otherwise download one of the Data sets in this site.
2. Generate the training set
After you have the ROS bag, you can use the depthDumper node to generate the images in a standard format (PGMs) needed by the calibration stack.
Example:
[Terminal 1] $ rosbag play <your_bag>
[Terminal 2] $ rosrun easydepthcalib depthDumper
- default subscription topics are /camera/depth/image_rawand /camera/depth/camera_info
- you can remap using the ROS standards
$ rosrun easyDepthCalib depthDumper _imageTopic:=<IMAGE_TOPIC_NAME> _cameraInfoTopic:=<CAMERA_INFO_TOPIC_NAME>
- when you stop the executable, you will find in the current folder:
1) an input index file (out.mal by default) that describes the sensor (K camera info matrix, topic name, columns, rows, ...) and contains the list of PGM files with depth values
2) all the depth images dumped as 16 bit PGM files
3. Generate the look-up table for the undistortion function
The look-up table of the undistortion function is generated from the software module offlineCalibration using the data generated in the previous step.
This module generates as output file a look-up table that contains an explicit representation of the undistortion function, used to correct the depth images, as described in the next step.
Notice that, from the training set obtained at Step 2, you can apply any other approximation algorithm and produce a look-up table in the same format.
the easyDepthCalibrationStack provides two basic utilities, the calibration model learner and the calibration tool
offlineCalibration
computes the calibration model (as a look-up table) from the files generated by easydepthcalib
It will produce a raw calibration matrix and an example KNN calibration matrix.
Use:
$ ./offlineCalibration <input_index_file> <calibration_model_file>
note: simplest way to use it is launching in the same directory of the log file and the pgm data.
4. Correct the depth images with the undistortion look-up
The tool batchCalibration can be used to correct depth images applying the undistortion look-up table computed in the previous step.
$ ./batchCalibration -i <original_pgm_dir> -o <undistorted_pgm_dir> -c <calibration_model_file>
Is also possible to run the online driver. It will subscribe to a depth_image topic to produce an undistorted depth_image in real time.