2-D projective geometric transformation
projective2d object encapsulates a 2-D projective
projective2d object encapsulates a 2-D projective geometric
You can create a
projective2d object using the following
fitgeotrans — Estimates
a geometric transformation that maps pairs of control points between two
projective2d function described here
tform = projective2d
tform = projective2d(A)
tform = projective2d creates an
affine2d object with default property settings that
correspond to the identity transformation.
tform = projective2d( sets the
T with a valid projective transformation defined
by nonsingular matrix
T— Forward 2-D projective transformation
Forward 2-D projective transformation, specified as a nonsingular 3-by-3 numeric matrix.
T uses the convention:
[x y 1] = [u v 1] * T
T has the form:
[a b c;... d e f;... g h i];
The default of
T is the identity
Dimensionality— Dimensionality of the geometric transformation
Dimensionality of the geometric transformation for both input and output points, specified as the value 2.
This example shows how to apply rotation and tilt to an image, using a
projective2d geometric transformation object created directly from a transformation matrix.
Read a grayscale image into the workspace.
I = imread('pout.tif');
Create a geometric transformation object. This example combines rotation and tilt into a transformation matrix,
tm. Use this transformation matrix to construct a
projective2d geometric transformation object,
theta = 10; tm = [cosd(theta) -sind(theta) 0.001; ... sind(theta) cosd(theta) 0.01; ... 0 0 1]; tform = projective2d(tm);
Apply the transformation using
imwarp. View the transformed image.
outputImage = imwarp(I,tform); figure imshow(outputImage);
Usage notes and limitations:
projective2d supports the generation of C
code (requires MATLAB®
Coder™). For more information, see Code Generation for Image Processing.
When generating code, you can only specify singular objects—arrays of objects are not supported.