Camera-Projector calibration Issue

asked 2015-08-15 01:19:28 -0500

yuvalg gravatar image

I'm trying to calibrate a Camera-Projector pair for 3D reconstruction. I'm using the software found at This software outputs the following : camera matrix, projector matrix, camera distortion, projector distortion, T,R. Also I'm getting a re-projection error of about 0.5 pixels for each device (intrinsic) and 1.5 pixels as a stereo error(extrinsic).

I plan to project a random-speckle pattern and use stereo matching to reconstruct the 3D scene. In order to do so I'm trying to use the openCV function stereoRectify with the given matrices and warp the camera image so I can match it with the known speckle-pattern pattern. I'm getting awful results using the following code :

stereoRectify(CameraMatrix, cameraDist,
              projMatrix  , projDist  ,
              imageSize, R, T, R1, R2, P1, P2, Q,
              CALIB_ZERO_DISPARITY, 1, imageSize, &validRoi[0], &validRoi[1]);

initUndistortRectifyMap(CameraMatrix, cameraDist, R2, P2, Size(1280,960) , CV_16SC2, rmap[0][0], rmap[0][1]);
initUndistortRectifyMap(projMatrix  , projDist  , R2, P2, Size(1771, 1063), CV_16SC2, rmap[1][0], rmap[1][1]);

remap(cameraImageGray, cameraImageUndistort, rmap[0][0], rmap[0][1], CV_INTER_LINEAR);
remap(projPatternGray, projPatternUndistort, rmap[1][0], rmap[1][1], CV_INTER_LINEAR);

I'm not sure if it's because the re-projection is to big or coding issue . I have experience calibrating standard stereo pairs but I can't figure out this issue.

Thanks Yuval

edit retag flag offensive close merge delete