kalibr icon indicating copy to clipboard operation
kalibr copied to clipboard

Problem with undistortion by OpenCV

Open imrasp opened this issue 6 years ago • 5 comments

I have tried to undistort the image from Euroc dataset using intrinsic and distortion coefficient provided by the dataset itself which using Kalibr as a calibration tool. The result is completely distorted as follow:

original image: 1403709066687836928 undistorted image: undistort_image_screenshot_17 01 2018

The method for unsidtort is (provided by opencv)

cv::undistort(image, imageUndistorted, intrinsic, distCoeffs);

I have try to undistort the image capture on my action camera and calibrated by opencv camera calibration. the result as follow:

original image: 26857637_1584994088243339_1603148252_n undistorted image: 26940790_1584994571576624_221106632_n

I tried recalibrate Euroc using calibration dataset on kalibr and got the same result as it provided in the datasets.

What did I do wrong on undistort the image and what is the different between Kalibr and Opencv for calibrating monocular camera

imrasp avatar Jan 17 '18 15:01 imrasp

Maybe the models between Kalibr/OpenCV are not matching. Kalibr implements distortion models that are not supported by OpenCV (e.g. the 'equidistant' model). Could you verify that the models are correct?

schneith avatar Jan 18 '18 10:01 schneith

@schneith Please suggest me a bit more on this, I am new to these calibration methods. Kalibr seems to support all distortion model (this link) including radial tangential which is the same as opencv distortion model. This is some context I copied from opencv website:

For the distortion OpenCV takes into account the radial and tangential factors.

This is the camera specification proposed by Euroc dataset

rate_hz: 20
resolution: [752, 480]
camera_model: pinhole
intrinsics: [458.654, 457.296, 367.215, 248.375] #fu, fv, cu, cv
distortion_model: radial-tangential
distortion_coefficients: [-0.28340811, 0.07395907, 0.00019359, 1.76187114e-05]

I think Euroc using the same distortion model as opencv but using these value I got the result above.

imrasp avatar Jan 18 '18 10:01 imrasp

Is there any way to convert kalibr distortion model to OpenCV supported format?

HTLife avatar May 30 '18 09:05 HTLife

pinhole-radtan is the same as the OpenCV model. pinhole-equi seems to be the same as OpenCV's "fisheye" camera model.

NikolausDemmel avatar May 30 '18 09:05 NikolausDemmel

@NikolausDemmel Thank you! I can now calibrate image with kalibr format yaml for by OpenCV.

The sample project is provided here for someone who might need it in the future. https://github.com/HTLife/tumvi_fisheye_calib

HTLife avatar May 30 '18 09:05 HTLife