Ask Your Question

pziyang's profile - activity

2020-08-05 15:10:57 -0600 received badge  Popular Question (source)
2020-06-08 12:45:30 -0600 received badge  Popular Question (source)
2014-03-31 01:06:05 -0600 received badge  Student (source)
2014-03-19 20:41:47 -0600 commented answer Stereocalibration coordinate origin question

never mind, I found the answer in the documentation under cv::stereorectify. Thanks!

2014-03-13 13:58:33 -0600 received badge  Editor (source)
2014-03-13 13:55:39 -0600 asked a question Stereorectify ROI Valid?

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 are here image description

So i performed stereocalibration using the following code. The reprojection error returned by cv::stereocalibrate is 0.6044. (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 here

image description

Question: 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 image description

The ROI region is clearly incorrect, but the stereorectified image seems good.

Question: Why is this so?

2014-03-10 15:46:15 -0600 commented answer Stereocalibration coordinate origin question

What about a top/bottom stereo-calibration?

2013-10-17 16:09:28 -0600 received badge  Supporter (source)
2013-10-17 15:11:02 -0600 received badge  Scholar (source)
2013-10-16 15:20:21 -0600 asked a question Stereocalibration coordinate origin question

Hi,

I have a question about the origin of the stereocalibration. I have a pair of cameras calibrated using cv::stereocalibrate. I wish to recover 3D physical coordinates of specific points in the image using cv::triangulatepoints.

The question is where is the origin and the axis orientation of the recovered (X,Y,Z) physical coordiantes? I didn't find information in opencv documentation.

In "Learning OpenCV: Computer Vision with the Opencv" by Gary Bradski, Adrian Kaehler, the authors defined the origin to be center of projection of the left camera, with X positive towards right camera, Y downwards and Z away from camera. Is this right?