stereo calibrate using pre-defined intrinsics

asked 2015-06-24 05:21:29 -0600

stillNovice gravatar image

updated 2015-06-24 05:40:09 -0600

I have a stereo camera rig. Each individual camera has a pre-calculated matrix.

fx  0  cx
0  fy  cy
0   0   1

and the camera output is already rectified, so the checkerboard images will be also.

I now need the relative transformation between the 2 cameras. Is it possible to give stereoCalibrate the intrinsic matrix info that I already have, and just get the R and T matrices back? How to go about this?

i have tried manually adding the Mtrix info:

Matx33f M1(716.917, 0, 328.413, 0, 716.917, 240.039, 0, 0, 1);
Matx33f M2(775.737, 0, 328.381, 0, 775.737, 240.516, 0, 0, 1);

but it gives me grey image output and a reprojection error 1.#IND.

I am using the stereo_calib example, and the relevant code I have is:

Mat cameraMatrix[2], distCoeffs[2];
cameraMatrix[0] = Mat::eye(3, 3, CV_64F);
cameraMatrix[1] = Mat::eye(3, 3, CV_64F);
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, 100, 1e-5),
                CV_CALIB_FIX_ASPECT_RATIO +
                CV_CALIB_ZERO_TANGENT_DIST +
                CV_CALIB_SAME_FOCAL_LENGTH +
                CV_CALIB_RATIONAL_MODEL +
                    CV_CALIB_FIX_K3 + CV_CALIB_FIX_K4 + CV_CALIB_FIX_K5);
edit retag flag offensive close merge delete