Documentation

This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

projective2d class

2-D projective geometric transformation

Description

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

You can create a `projective2d` object using the following methods:

• `fitgeotrans` — Returns a `projective2d` object that maps control point pairs

• The `projective2d` class constructors

Construction

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

`tform = projective2d(A)` creates a `projective2d` object given an input 3-by-3 matrix `A` that specifies a valid projective transformation.

Input Arguments

expand all

Forward 2-D projective transformation, specified as a 3-by-3 numeric matrix. `A` has the form:

``` A = [a b c; d e f; g h i] ```

Data Types: `double` | `single`

Properties

expand all

Forward 2-D projective transformation, specified as a 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`

Describes the dimensionality of the geometric transformation for both input and output points.

Methods

 invert Invert geometric transformation outputLimits Find output spatial limits given input spatial limits transformPointsForward Apply forward geometric transformation transformPointsInverse Apply inverse 2-D geometric transformation to points

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects (MATLAB) in the MATLAB® documentation.

Examples

expand all

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, `tform`.

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

Create a `projective2d` object that defines the transformation.

```theta = 10; tform = projective2d([cosd(theta) -sind(theta) 0.001; sind(theta) cosd(theta) 0.01; 0 0 1]); ```
```tform = projective2d with properties: T: [3x3 double] Dimensionality: 2```

Apply forward geometric transformation to an input point.

```[X,Y] = transformPointsForward(tform,5,10) ```
```X = 6.0276 Y = 8.1265```

Apply inverse geometric transformation to output point from previous step to recover the point we started with.

```[U,V] = transformPointsInverse(tform,X,Y) ```
```U = 5.0000 V = 10```