invert
Invert geometric transformation
Syntax
Description
Examples
Invert 2-D Rotation
Read and display an image.
I = imread("pout.tif");
imshow(I)
Create a rigidtform2d
object that defines a 30 degree clockwise rotation around the origin.
translation = [0 0]; theta = 30; tform = rigidtform2d(theta,translation);
Apply the forward geometric transformation, tform
, to the image. Display the rotated image.
J = imwarp(I,tform); imshow(J)
Invert the geometric transformation. The result is a new rigidtform2d
object that represents a 30 degree rotation in the counterclockwise direction.
invtform = invert(tform);
Apply the inverse geometric transformation, invtform
, to the rotated image J
. 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)
Input Arguments
tform
— Geometric transformation
geometric transformation object
Geometric transformation, specified as a geometric transformation object listed in the table.
Geometric Transformation Object | Description |
---|---|
2-D Geometric Transformations | |
transltform2d | Translation transformation |
rigidtform2d | Rigid transformation: translation and rotation |
simtform2d | Similarity transformation: translation, rotation, and isotropic scaling |
affinetform2d | Affine transformation: translation, rotation, anisotropic scaling, reflection, and shearing |
projtform2d | Projective transformation |
3-D Geometric Transformations | |
transltform3d | Translation transformation |
rigidtform3d | Rigid transformation: translation and rotation |
simtform3d | Similarity transformation: translation, rotation, and isotropic scaling |
affinetform3d | Affine transformation: translation, rotation, anisotropic scaling, reflection, and shearing |
Note
You can also specify tform
as an object of type
rigid2d
, rigid3d
, affine2d
, affine3d
, or projective2d
. However,
these objects are not recommended. For more information, see Version History.
Output Arguments
tformInv
— Inverse geometric transformation
geometric transformation object
Inverse geometric transformation, returned as a geometric transformation
object of the same type as tform
.
Version History
Introduced in R2013aR2022b: Supports new geometric transformation objects
Starting in R2022b, most Image Processing Toolbox™ functions create and perform geometric transformations using the
premultiply convention. Accordingly, you can now specify tform
as a geometric transformation object that uses the premultiply convention, such as
an affinetform2d
object.
Although invert
still supports objects that use the
postmultiply convention, such as affine2d
object, these objects are
not recommended. You can streamline your geometric transformation workflows by
switching to the new premultiply geometric transformation objects. For more
information, see Migrate Geometric Transformations to Premultiply Convention.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)