c++opencvroistereoscopy

Stereo rectify - ROI have different sizes


I have done a stereo calibration and I got the validPixROI1 and 2 (green border). Now I want to use StereoSGBM but the rois from calibration (from stereoRectify) are not the same size. Anyone know how to solve this?

Actually I do somethine linke this:

Rect roiLeft(...);
Rect roiRight(...);

Mat cLeft(rLeft, roiLeft);
//Mat cRight(rRight, roiRight); // not same size...
Mat cRight(cRight, roiLeft);

stereoBM(cLeft,cRight, dst);

If I crop my images with that roi, will be the picture middle point be the same?

Here it works.

enter image description here


Solution

  • According to wiki

    A point R at the intersection of the optical axis and the image plane. This point is referred to as the principal point or image center.

    So I don't think the center will be same. Refer to this site . Here in one of the examples the principal point is 302.71656,242.33386 for a 640x480 pixel camera which shows that the principal point and the image center are not the same.