0
votes

I'm trying to calibrate my stereo cameras using OpenCV's off-the-shelf stereo calibration code (using all default parameters and using Bouguet's algorithm), but the rectified images do not show good calibration: they are cropped in so much that the images are comprised of just a few pixels. I'm not sure what I did, as I was able to get this calibration script to work with a different pair of cameras... I'm using 20 pairs of images for the calibration and varying the orientation of the chessboard relative to the camera in each image. Any advice would be greatly appreciated!

1

1 Answers

1
votes

I found a solution! It turns out that the using the default values of CALIB_FIX_K3 + CALIB_FIX_K4 + CALIB_FIX_K5 in the flag argument to cv::stereoCalibrate caused this issue, and simply removing them fixed the problem. For clarity, this is what the working function call looks like:

double rms = stereoCalibrate(objectPoints, imagePoints[0], imagePoints[1],
                                 cameraMatrix[0], distCoeffs[0],
                                 cameraMatrix[1], distCoeffs[1],
                                 imageSize, R, T, E, F,
                                 CALIB_FIX_ASPECT_RATIO +
                                 CALIB_ZERO_TANGENT_DIST +
                                 CALIB_USE_INTRINSIC_GUESS +
                                 CALIB_SAME_FOCAL_LENGTH +
                                 CALIB_RATIONAL_MODEL,
                                 TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 100, 1e-5) );