This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Invert geometric transformation


invtform = invert(tform)



invtform = invert(tform) returns the inverse of the geometric transformation tform.


collapse all

Create an affine2d object that defines a 30 degree rotation in the counterclockwise direction around the origin. View the transformation matrix stored in the T property.

theta = 30;
tform = affine2d([cosd(theta) sind(theta) 0; -sind(theta) cosd(theta) 0; 0 0 1]);
ans = 3×3

    0.8660    0.5000         0
   -0.5000    0.8660         0
         0         0    1.0000

Invert the geometric transformation. The result is a new affine2d object.

invtform = invert(tform);
ans = 3×3

    0.8660   -0.5000         0
    0.5000    0.8660         0
         0         0    1.0000

This matrix represents a 30 degree rotation in the clockwise direction.

Test the Inverse Geometric Transformation

Read an image, and display it.

I = imread('pout.tif');

Apply the forward geometric transformation, tform, to the image. Display the rotated image.

J = imwarp(I,tform);

Apply the inverse geometric transformation, invtform, to the rotated image J.

K = imwarp(J,invtform);

The final image, K, has the correct orientation. The two transformations introduced padding that surrounds the image, but the size, shape, and orientation of the image data have not changed.

Input Arguments

collapse all

Geometric transformation, specified as an affine2d, affine3d, or projective2d geometric transformation object.

Output Arguments

collapse all

Inverse geometric transformation, returned as a geometric transformation object. invtform is the same type of object as tform.

Introduced in R2013a