Main Content

invert

在vert geometric transformation

Description

example

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

Examples

collapse all

Read and display an image.

I = imread('pout.tif'); imshow(I)

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

Create anaffine2dobject that defines a 30 degree clockwise rotation around the origin. View the transformation matrix stored in theTproperty.

theta = 30; tform = affine2d([cosd(theta) sind(theta) 0; -sind(theta) cosd(theta) 0; 0 0 1]); tform.T
ans =3×30.8660 0.5000 0 -0.5000 0.8660 0 0 0 1.0000

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

J = imwarp(I,tform); imshow(J)

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

在vert the geometric transformation. The result is a newaffine2dobject that represents a 30 degree rotation in the counterclockwise direction.

invtform = invert(tform); invtform.T
ans =3×30.8660 -0.5000 0 0.5000 0.8660 0 0 0 1.0000

Apply the inverse geometric transformation,invtform, to the rotated imageJ. The final image,K, has the same size, shape, and orientation as the original image. Black padding around the image results from the two transformations.

K = imwarp(J,invtform); imshow(K)

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

在put Arguments

collapse all

Geometric transformation, specified as anaffine2d,affine3d,rigid2d,rigid3d, orprojective2dgeometric transformation object.

Output Arguments

collapse all

在verse geometric transformation, returned as a geometric transformation object.invtformis the same type of object astform.

在troduced in R2013a