Main Content

estimateUncalibratedRectification

(Not recommended) Uncalibrated stereo rectification

estimateUncalibratedRectification is not recommended. Use the estimateStereoRectification function instead. For more information, see Version History.

Description

[T1,T2] = estimateUncalibratedRectification(F,inlierPoints1,inlierPoints2,imagesize) returns projective transformations for rectifying stereo images. This function does not require either intrinsic or extrinsic camera parameters.

example

Examples

collapse all

This example shows how to compute the fundamental matrix from corresponding points in a pair of stereo images.

Load the stereo images and feature points which are already matched.

I1 = imread('yellowstone_left.png');
I2 = imread('yellowstone_right.png');
load yellowstone_inlier_points;

Display point correspondences. Notice that the matching points are in different rows, indicating that the stereo pair is not rectified.

showMatchedFeatures(I1, I2,inlier_points1,inlier_points2,'montage');
title('Original images and matching feature points');

Figure contains an axes object. The hidden axes object with title Original images and matching feature points contains 4 objects of type image, line. One or more of the lines displays its values using only markers

Compute the fundamental matrix from the corresponding points.

f = estimateFundamentalMatrix(inlier_points1,inlier_points2,...
    'Method','Norm8Point');

Compute the rectification transformations.

[t1, t2] = estimateUncalibratedRectification(f,inlier_points1,...
    inlier_points2,size(I2));

Rectify the stereo images using projective transformations t1 and t2.

[I1Rect,I2Rect] = rectifyStereoImages(I1,I2,t1,t2);

Display the stereo anaglyph, which can also be viewed with 3-D glasses.

figure;
imshow(stereoAnaglyph(I1Rect,I2Rect));

Figure contains an axes object. The hidden axes object contains an object of type image.

Input Arguments

collapse all

Fundamental matrix for the stereo images, specified as a 3-by-3 fundamental matrix. The fundamental matrix satisfies the following criteria:

If P1, a point in image 1, corresponds to P2, a point in image 2, then:
[P2,1] *F * [P1,1]' = 0

Data Types: single | double

Coordinates of corresponding points in image one, specified as an M-by-2 matrix of M number of [x y] coordinates, or as a ORBPoints, BRISKPoints, SIFTPoints, SURFPoints, MSERRegions, or cornerPoints object.

Coordinates of corresponding points in image two, specified as an M-by-2 matrix of M number of [x y] coordinates, or as a ORBPoints, BRISKPoints, SIFTPoints, SURFPoints, MSERRegions , or cornerPoints object.

Second input image size, specified as a double, single, or integer value and in the format returned by the size function. The size of input image 2 corresponds to inlierPoints2.

Output Arguments

collapse all

Projective transformation, returned as a 3-by-3 matrix describing the projective transformations for input image T1.

Projective transformation, returned as a 3-by-3 matrix describing the projective transformations for input image T2.

Tips

  • An epipole may be located in the first image or the second image. Applying the output uncalibrated rectification of T1 (or T2) to image 1 (or image 2) may result in an undesired distortion. You can check for an epipole within an image by applying the isEpipoleInImage function.

References

[1] Hartley, Richard, and Andrew Zisserman. Multiple View Geometry in Computer Vision. 2nd ed. Cambridge, UK ; New York: Cambridge University Press, 2003.

[2] Pollefeys, M., Koch, R., and Van Gool, L.. A Simple and Efficient Rectification Method for General Motion. Proceedings of the Seventh IEEE International Conference on Computer Vision. Volume 1, pages 496-501. 1999. DOI:10.1109/ICCV.1999.791262.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2012b

collapse all

R2022b: Not recommended

Starting in R2022b, most Computer Vision Toolbox™ functions create and perform geometric transformations using the premultiply convention. However, the estimateUncalibratedRectification function uses the postmultiply convention. Although there are no plans to remove estimateUncalibratedRectification at this time, you can streamline your geometric transformation workflows by switching to the estimateStereoRectification function, which supports the premultiply convention. For more information, see Migrate Geometric Transformations to Premultiply Convention.

To update your code:

  • Change instances of the function name estimateUncalibratedRectification to estimateStereoRectification.

  • The estimateStereoRectification function returns the projective transformations as projtform2d objects, which use the premultiply convention. If you need to obtain the projective transformation matrices, then you can query the A property of the projtform2d objects. Note that the values of A are the transpose of T1 and T2.