Main Content

projective2d

(Not recommended) 2-D projective geometric transformation using postmultiply convention

projective2d is not recommended. Use the projtform2d object instead. For more information, see Version History.

Description

A projective2d object encapsulates a 2-D projective geometric transformation.

Creation

You can create a projective2d object using the following methods:

  • fitgeotrans — Estimates a geometric transformation that maps pairs of control points between two images

  • The projective2d function described here

Description

tform = projective2d creates a projective2d object with default property settings that correspond to the identity transformation.

tform = projective2d(A) sets the property T as the specified 2-D projective transformation matrix t.

example

Properties

expand all

Forward 2-D projective transformation, specified as a nonsingular 3-by-3 numeric matrix. The matrix T uses the convention:

[x y 1] = [u v 1] * T

where T has the form:

[a b c; ...
 d e f; ...
 g h i];

The default of T is the identity transformation.

Data Types: double | single

This property is read-only.

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

Object Functions

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

Examples

collapse all

Combine rotation and tilt into a transformation matrix, tm. Use this transformation matrix to create a projective2d geometric transformation object, tform.

theta = 10;
tm = [cosd(theta) -sind(theta) 0.001; ...
      sind(theta) cosd(theta) 0.01; ...
      0 0 1];
tform = projective2d(tm)
tform = 
  projective2d with properties:

                 T: [3x3 double]
    Dimensionality: 2

Examine the value of the T property.

tform.T
ans = 3×3

    0.9848   -0.1736    0.0010
    0.1736    0.9848    0.0100
         0         0    1.0000

Extended Capabilities

Version History

Introduced in R2013a

expand all

R2022b: Not recommended

Starting in R2022b, most Image Processing Toolbox™ functions create and perform geometric transformations using the premultiply convention. Accordingly, the projective2d object is not recommended because it uses the postmultiply convention. Although there are no plans to remove the projective2d object at this time, you can streamline your geometric transformation workflows by switching to the projtform2d object, which supports the premultiply convention. For more information, see Migrate Geometric Transformations to Premultiply Convention.

To update your code:

  • Change instances of the function name projective2d to projtform2d.

  • Specify the transformation matrix as the transpose of the matrix T, where T is either the value of the T property of the projective2d object or the transformation matrix used to create the projective2d object.

Discouraged UsageRecommended Replacement

This example creates a projective2d object from transformation matrix T in the postmultiply convention.

T = [2 0.33 0; 0 1 0; 5 10 1];
tformPost = projective2d(T);

This example creates a projtform2d object from the transpose of the transformation matrix T.

T = [2 0.33 0; 0 1 0; 5 10 1];
A = T';
tform = projtform2d(A);

This example starts with a projective2d object called tformPost and creates a projtform2d object from the transpose of the T property of tformPost.

T = tformPost.T;
tform = projtform2d(T');