# projtform2d

2-D projective geometric transformation

## 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.

### Syntax

``tform = projtform2d``
``tform = projtform2d(A)``
``tform = projtform2d(tformIn)``

### Description

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

example

````tform = projtform2d(A)` creates a `projtform2d` object and sets the property `A` as the specified 2-D projective transformation matrix.```
````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 nonsingular 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:

`$\left[\begin{array}{c}{x}^{\prime }\\ {y}^{\prime }\\ k\end{array}\right]=Α×\left[\begin{array}{c}u\\ v\\ 1\end{array}\right]$`

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

Data Types: `double` | `single`

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

Data Types: `double`

## Object Functions

 `invert` Invert geometric transformation `outputLimits` Find output spatial limits given input spatial limits `transformPointsForward` Apply forward geometric transformation `transformPointsInverse` Apply 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: [3x3 double] ```

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 ```

## Version History

Introduced in R2022b

expand all