Main Content

projtform2d

2-D projective geometric transformation

Since R2022b

    Description

    A projtform2d object stores information about a 2-D projective geometric transformation and enables forward and inverse transformations.

    Creation

    You can create a projtform2d object in these ways:

    • fitgeotform2d — Estimate a geometric transformation that maps pairs of control points between two images.

    • The projtform2d function described here.

    Description

    tform = projtform2d creates a projtform2d object that performs an identity transformation.

    tform = projtform2d(A) creates a projtform2d object and sets the property A as the specified 2-D projective transformation matrix.

    example

    tform = projtform2d(tformIn) creates a projtform2d object from another geometric transformation object, tformIn, that represents a valid 2-D projective geometric transformation.

    Input Arguments

    expand all

    Projective 2-D geometric transformation, specified as an affinetform2d object, rigidtform2d object, simtform2d object, transltform2d object, or projtform2d object.

    Properties

    expand all

    Forward 2-D projective transformation, specified as a 3-by-3 numeric matrix. The default value of A is the identity matrix.

    The matrix A transforms the point (u, v) in the input coordinate space to the point (x, y) in the output coordinate space using the convention:

    [xyk]=Α×[uv1]

    where x = xʹ / k and y = yʹ / k.

    Data Types: double | single

    This property is read-only.

    Dimensionality of the geometric transformation for both input and output points, specified as 2.

    Data Types: double

    Object Functions

    invertInvert geometric transformation
    outputLimitsFind output spatial limits given input spatial limits
    transformPointsForwardApply forward geometric transformation
    transformPointsInverseApply inverse geometric transformation

    Examples

    collapse all

    Define a 3-by-3 geometric transformation matrix. This matrix specifies a projective transformation consisting of rotation and tilt.

    theta = 30;
    A = [cosd(theta) -sind(theta) 0; ...
         sind(theta)  cosd(theta) 0; ...
         0.001        0.001       1];

    Create a projtform2d object from the transformation matrix.

    tform = projtform2d(A)
    tform = 
      projtform2d with properties:
    
        Dimensionality: 2
    
                     A: [0.8660   -0.5000         0
                         0.5000    0.8660         0
                         0.0010    0.0010    1.0000]
    
    

    Examine the value of the A property.

    tform.A
    ans = 3×3
    
        0.8660   -0.5000         0
        0.5000    0.8660         0
        0.0010    0.0010    1.0000
    
    

    Extended Capabilities

    Version History

    Introduced in R2022b

    expand all