I noticed that opencv stereoCalibrate () changes the focal lengths in the camera matrices, even if I set the appropriate flag (i.e. CV_CALIB_FIX_FOCAL_LENGTH). I use two identical cameras with the same focal length mounted mechanically on the lens, and in addition, I know the size of the sensor, so I can manually calculate the internal matrix of the camera, which I actually do.
Here you have a way out of the stereo calibration program - the camera matrix before and after stereoCalibrate ().
std::cout << "Before calibration: " << std::endl;
std::cout << "C1: " << _cameraMatrixA << std::endl;
std::cout << "C2: " << _cameraMatrixB << std::endl;
double error = cv::stereoCalibrate(objectPoints, imagePointsA, imagePointsB, _cameraMatrixA, _distCoeffsA, _cameraMatrixB, _distCoeffsB, _imageSize,
R, T, E, F,
cv::TermCriteria((cv::TermCriteria::COUNT + cv::TermCriteria::EPS), 30, 9.999999999999e-7), CV_CALIB_FIX_FOCAL_LENGTH | CV_CALIB_FIX_PRINCIPAL_POINT);
std::cout << "After calibration: " << std::endl;
std::cout << "C1: " << _cameraMatrixA << std::endl;
std::cout << "C2: " << _cameraMatrixB << std::endl;
Before calibration:
C1: [6203.076923076923, 0, 1280; 0, 6203.076923076923, 960; 0, 0, 1]
C2: [6203.076923076923, 0, 1280; 0, 6203.076923076923, 960; 0, 0, 1]
After calibration:
C1: [6311.77650416514, 0, 1279.5; 0, 6331.34531760757, 959.5; 0, 0, 1]
C2: [6152,655897294907, 0, 1279,5; 0, 6206,591406832492, 959,5; 0, 0, 1]
, opencv. - ? , , .