我在校准两个相机时遇到问题:第一个是 rgb,第二个是红外线。它们有不同的分辨率(我调整大小并裁剪了更大的图像)、焦距等......
例子:
RGB 1920x1080
红外线 512x424
如何相互校准?我应该在 stereoCalibrate 中使用哪些参数。默认样本 stereo_calib.cpp 产生非常大的错误。像这样的东西:https ://www.dropbox.com/s/x57rrzp1ejm3cac/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82 %202014-04-05%2012.54.17.png
以 RMS 误差 = 4.1026 完成
平均重投影误差 = 10.2601
更新
我使用calibration.cpp 示例为每个相机独立生成了校准参数。对于 RGB 相机,我首先调整图像大小并将图像裁剪为与红外相机 (512x424) 匹配的分辨率,然后进行校准。对于 RGB 相机,我得到 camera.yml,对于 IR 相机,我得到 camera_ir.yml。然后我尝试使用修改的 stereo_calib.cpp 示例进行立体校准。在调用stereoCalibrate之前,我从文件中读取相机的camera_matrix和distortion_coefficients参数,并将这些矩阵放入stereoCalibrate。
FileStorage rgbCamSettings("camera.yml", CV_STORAGE_READ);
Mat rgbCameraMatrix;
Mat rgbDistCoeffs;
rgbCamSettings["camera_matrix"] >> rgbCameraMatrix;
rgbCamSettings["distortion_coefficients"] >> rgbDistCoeffs;
FileStorage irCamSettings("camera_ir.yml", CV_STORAGE_READ);
Mat irCameraMatrix;
Mat irDistCoeffs;
irCamSettings["camera_matrix"] >> irCameraMatrix;
irCamSettings["distortion_coefficients"] >> irDistCoeffs;
Mat cameraMatrix[2], distCoeffs[2];
cameraMatrix[0] = rgbCameraMatrix;
cameraMatrix[1] = irCameraMatrix;
distCoeffs[0] = rgbDistCoeffs;
distCoeffs[1] = irDistCoeffs;
Mat R, T, E, F;
double rms = stereoCalibrate(objectPoints, imagePoints[0], imagePoints[1],
cameraMatrix[0], distCoeffs[0],
cameraMatrix[1], distCoeffs[1],
imageSize, R, T, E, F,
TermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 50, 1e-6),
CV_CALIB_FIX_INTRINSIC +
CV_CALIB_USE_INTRINSIC_GUESS
);