ethz-asl / kalibr

The Kalibr visual-inertial calibration toolbox
Other
4.33k stars 1.4k forks source link

Add a new stereo matching validator for multiple camera calibration #678

Open HViktorTsoi opened 6 months ago

HViktorTsoi commented 6 months ago

This PR add a new stereo matching validator to validate and visualize the result of multiple camera calibration. It uses the calibration result (the yaml file) from the last kalibr_calibrate_cameras step, undistorts and recitifies the images, and then run a stereo matcher to calculate the disparity map. No Calibration Target is Required in This Validator.

The stereo disparity map offers an intuitive, direct and comprehensive way to quickly visualize the calibration result. For example, a successful calibration may yield the following disparity results:

(with opencv sgbm stereo matcher) Screenshot from 2024-03-31 02-04-09

(with opencv bm stereo matcher) Screenshot from 2024-03-31 02-00-58 The depth of the ground plane and object surface is uniform and smooth.

While a bad calibration result leads to failed stereo matching (because of poor rectification) , resulting in a disparity map looks like this Screenshot from 2024-03-31 02-03-17 Note there are lots of speckles and the ground plane is missing.

Usage:

python kalibr_camera_validator_stereo_match --cam ${path-to-camchain.yaml} --matcher bm --scale 2

or

python kalibr_camera_validator_stereo_match --cam ${path-to-camchain.yaml} --matcher sgbm --scale 2

the --matcher option selects the stereo matching algorithm (bm or sgbm). The --scale option determines how many times we downsample the image to speed up stereo matching .