I'm doing a stereovision setup. With 2 cameras mounted above a wing. The left camera is tilted a few degree inwards while the right camera in parallel with the wing.
Image of left and right view and .
So i performed stereocalibration using (note: snippets of code, cut and pasted, but does not compile as is)
// performing stereocalibration given imagePoint_leftcamera and rightcamera
Flea3.reproj_error = stereoCalibrate(objectPoints,imagePoints_left,imagePoints_right,cameraMatrix_left,
distCoeffs_left,cameraMatrix_right,distCoeffs_right,imageSize, Flea3.R, Flea3.T, Flea3.E, Flea3.F,
TermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, 1e-5),
CV_CALIB_FIX_INTRINSIC );
// Peform stereorectification
stereoRectify(cameraMatrix_left, distCoeffs_left, cameraMatrix_right, distCoeffs_right, imageSize,
Flea3.R, Flea3.T, Flea3.R1, Flea3.R2, Flea3.P1, Flea3.P2, Flea3.Q, CALIB_ZERO_DISPARITY, -1, Size(), &Flea3.validRoi_left, &Flea3.validRoi_right);
The remapped images using
//computes undistort and rectify maps
initUndistortRectifyMap(cameraMatrix_left, distCoeffs_left, R1, P1, imageSize, CV_16SC2, rmap[0][0], rmap[0][1]);
initUndistortRectifyMap(cameraMatrix_right, distCoeffs_right, R2, P2, imageSize, CV_16SC2, rmap[1][0], rmap[1][1]);
and
remap(src_left, img_left, rmap[0][0], rmap[0][1], CV_INTER_LINEAR);
remap(src_right, img_right, rmap[1][0], rmap[1][1], CV_INTER_LINEAR);
are and
Shouldn't the black remapped region from the right image be on the right side (since we're forming a frontal parallel configuration in stereorectify?
Also, the ROI regions returned is strange, denoted by red box here in the stitched image () [warning huge file, smaller file . The ROI region is clearly incorrect, but the stereorectified image seems good.
Why is this so?