简体   繁体   English

OpenCV 立体校准产生微小/零大小的 ROI

[英]OpenCV stereo calibration produces tiny/zero-sized ROI

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.我正在尝试使用 OpenCV 的现成立体校准代码(使用所有默认参数并使用 Bouguet 算法)校准我的立体相机,但校正后的图像没有显示出良好的校准:它们被裁剪得太多以至于图像仅由几个像素组成。 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.我不确定我做了什么,因为我能够让这个校准脚本与另一对相机一起工作......我正在使用 20 对图像进行校准并改变棋盘相对于每个图像中的相机。 Any advice would be greatly appreciated!任何建议将不胜感激!

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.事实证明,在cv::stereoCalibrate的标志参数中使用CALIB_FIX_K3 + CALIB_FIX_K4 + CALIB_FIX_K5的默认值会导致此问题,只需删除它们即可解决问题。 For clarity, this is what the working function call looks like:为清楚起见,这是工作 function 调用的样子:

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) );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM