Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mirroring using Hartley Rectification

Hi, I've been using Hartley Calibration Algorithm, since stereoCalibrate/stereoRectify delivers no output due to high baseline Stereo with Camera Rotation.

The left image though heavily sheared and mirrored.

image description

I've used the anti-shearing algorithm by Zhang, but it doesn't revert the mirroring.

Here is the Homographic Matrix I obtain from stereoRectifyUncalibrated:

H1(left):
[-0,09377726121369795, 0,04328690336693735, 86,72993843873914;
 -0,004977161606602101, 0,155454257309974, 3,550060089738537;
 -1,736436872968937e-05, -4,655031712266116e-07, 0,1663350901457538]

Here is the shearing transform matrix I obtain from my anti-shearing implementation:

shear matrix (left): 
[1,683146574043227, -0,5007180072161737, 0;
 0, 1, 0;
 0, 0, 1]

I have to add a translation matrix, because the shearing moves the image to the right, so I calculate:

T: 
[1, 0, -144,2016197365122;
 0, 1, 0;
 0, 0, 1]

(with T.at(0,2) from:

vec = shear * H1 * (0,0)                   //top left point of image
T.at(0,2) = 0 - vec.at(0,0)

)

Here is the picture when I calculate the new homography:

newH1 = T * shear * H1

image description

Even though the image is now pretty straight and moved into the picture now it is still mirrored....

I'm hesitant to simply set the first value of H1 to it's positive value since I got the feeling there might be something wrong at another place. Am I getting something from the calculation, is there a known problem with the Hartley Algorithm, that it mirrors the images? Any advice appreciated!

Mirroring using Hartley Rectification

Hi, I've been using Hartley Calibration Algorithm, since stereoCalibrate/stereoRectify delivers no output due to high baseline Stereo with Camera Rotation.

The left image though heavily sheared and mirrored.

image description

I've used the anti-shearing algorithm by Zhang, but it doesn't revert the mirroring.

Here is the Homographic Matrix I obtain from stereoRectifyUncalibrated:

H1(left):
[-0,09377726121369795, 0,04328690336693735, 86,72993843873914;
 -0,004977161606602101, 0,155454257309974, 3,550060089738537;
 -1,736436872968937e-05, -4,655031712266116e-07, 0,1663350901457538]
[-0.09377726121369795, 0.04328690336693735, 86.72993843873914;
 -0.004977161606602101, 0.155454257309974, 3.550060089738537;
 -1.736436872968937e-05, -4.655031712266116e-07, 0.1663350901457538]

Here is the shearing transform matrix I obtain from my anti-shearing implementation:

shear matrix (left): 
[1,683146574043227, -0,5007180072161737, [1.683146574043227, -0.5007180072161737, 0;
 0, 1, 0;
 0, 0, 1]

I have to add a translation matrix, because the shearing moves the image to the right, so I calculate:

T: 
[1, 0, -144,2016197365122;
-144.2016197365122;
 0, 1, 0;
 0, 0, 1]

(with T.at(0,2) from:

vec = shear * H1 * (0,0)                   //top left point of image
T.at(0,2) = 0 - vec.at(0,0)

)

Here is the picture when I calculate the new homography:

newH1 = T * shear * H1

image description

Even though the image is now pretty straight and moved into the picture now it is still mirrored....

I'm hesitant to simply set the first value of H1 to it's positive value since I got the feeling there might be something wrong at another place. Am I getting something from the calculation, is there a known problem with the Hartley Algorithm, that it mirrors the images? Any advice appreciated!