Ask Your Question

Are distortion coefficients returned by cv::stereoCalibrate correct?

asked 2013-08-28 10:48:27 -0600

dumbDumb gravatar image

updated 2013-09-27 12:05:54 -0600

// This bug is fixed by Pritam Shete(


I tried to use cv::stereoCalibrate to calibrate the cameras. However the distortion coefficients returned by cv::stereoCalibrate seemed to be wrong. I didn't set up the flag "CALIB_THIN_PRISM_MODEL"(I passed CV_CALIB_RATIONAL_MODEL as the flag), but I still got the nonzero s1, s2, s3, and s4 in returned array.

Is this correct result?

In calibration.cpp - line#2038, I thought distCoeffs->cols == 12, and Dist[k] had only 8 component. Why there is no code setting the last 4 components in distortion coefficients to zero?

The distortion coefficients I got are

distCoeffs1:[k_1_A, k_2_A, p_1_A, p_2_A, k_3_A, k_4_A, k_5_A, k_6_A, k_1_B, k_2_B, p_1_B, p_2_B]

distCoeffs2:[k_1_B, k_2_B, p_1_B, p_2_B, k_3_B, k_4_B, k_5_B, k_6_B, ?, ?, ?, ?]

edit retag flag offensive close merge delete



As StevenPuttemans always says, dont use hashtags in the tags. Although they get proposed, they create doubles and make forum search harder.

Moster gravatar imageMoster ( 2013-08-28 12:01:39 -0600 )edit

Refer to OpenCv documentation on Camera calibration -

Please see the equations before watching the code, they would give you logical explanation of the camera calibration process.

utkarshmankad gravatar imageutkarshmankad ( 2013-08-28 23:33:39 -0600 )edit

Thank you. I had read the documentation. I don't know why the last four components(s_1, s_2, s_3, s_4) returned by cv::stereoCalibrate are nonzero when I only pass CV_CALIB_RATIONAL_MODEL as "flag". Are those four components are effective when I pass CALIB_THIN_PRISM_MODEL to cv::stereoCalibrate. Or should I set those components in 12-element distortion coefficients to zero by myself before calling initUndistortRectifyMap?

dumbDumb gravatar imagedumbDumb ( 2013-08-29 02:24:24 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-27 12:08:45 -0600

dumbDumb gravatar image
edit flag offensive delete link more

Question Tools


Asked: 2013-08-28 10:48:27 -0600

Seen: 932 times

Last updated: Sep 27 '13