# Estimate Geometric Transformation

Estimate geometric transformation from matching point pairs

• Library:
• Computer Vision Toolbox / Geometric Transformations

• ## Description

Use the Estimate Geometric Transformation block to find the transformation matrix which maps the greatest number of point pairs between two images. A point pair refers to a point in the input image and its related point on the image created using the transformation matrix. You can select to use the RANdom SAmple Consensus (RANSAC) or the Least Median Squares algorithm to exclude outliers and to calculate the transformation matrix. You can also use all input points to calculate the transformation matrix.

## Ports

### Input

expand all

Point coordinates, specified as an M-by-2 matrix of one-based [x y] point coordinates, where M represents the number of points.

The block outputs the same data type for the transformation matrix as the Pts1 and Pts2 image points.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `uint8` | `uint16` | `uint32`

Point coordinates, specified as an M-by-2 matrix of one-based [x y] point coordinates, where M represents the number of points.

The block outputs the same data type for the transformation matrix as the Pts1 and Pts2 image points.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `uint8` | `uint16` | `uint32`

Number of valid points to find in Pts1 and Pts2, specified as a scalar. This port appears when you enable the Allow variable-size signal input parameter.

Data Types: `int8` | `int16` | `int32` | `uint8` | `uint16` | `uint32`

### Output

expand all

Transformation, returned as either a 3-by-2 or a 3-by-3 matrix. The block outputs the same data type for the transformation matrix as the Pts1 and Pts2 image points.

#### Dependencies

• When Pts1 and Pts2 are single or double, the output transformation matrix will also have single or double data type.

• When Pts1 and Pts2 images are built-in integers, the option is available to set the transformation matrix data type to either `Single` or `Double`.

Data Types: `single` | `double`

Points used to calculate `TForm`, returned as an M-by-1 vector.

#### Dependencies

• The Inlier port appears when you enable the Output Boolean signal indicating which point pairs are inliers parameter.

Data Types: `Boolean`

## Parameters

expand all

Specify the transformation type as either ```Nonreflective similarity```, `Affine`, or `Projective`. See Transformations for a more detailed discussion.

#### Dependencies

You can set additional parameters depending on the transformation type:

• For `Projective` transformation, you can specify a scalar algebraic distance threshold for determining inliers.

• For `Affine` or ```Nonreflective similarity``` transformation, you can specify the distance threshold for determining inliers in pixels.

Enable to find and exclude outliers from the input points and use only the inlier points to calculate the transformation matrix. When you turn this parameter off, all input points are used to calculate the transformation matrix.

Select the method to find outliers as either ```RANdom SAmple Consensus (RANSAC)``` or `Least Median of Squares` See RANSAC and Least Median Squares Algorithms for a more detailed discussion.

#### Dependencies

This parameter appears when you enable the Find and exclude outliers check box.

Specify a scalar threshold value for determining inliers. The threshold controls the upper limit used to find the algebraic distance in the RANSAC algorithm.

#### Dependencies

This parameter appears when you set the Method parameter to `Random Sample Consensus (RANSAC)` and the Transformation type parameter to `Projective`.

Specify the upper limit distance a point can differ from the projection location of its corresponding point.

#### Dependencies

This parameter appears when you set the Method parameter to `Random Sample Consensus (RANSAC)` and you set the value of the Transformation type parameter to ```Nonreflective similarity``` or `Affine`.

Select `Specified value ` to enter a positive integer value for the number of random samplings. Select ```Desired confidence``` to set the number of random samplings as a percentage and a maximum number.

#### Dependencies

This parameter appears when you select the Find and exclude outliers check box, and you set the value of the Method parameter to ```Random Sample Consensus (RANSAC)```.

Specify the number of random samplings for the algorithm to perform.

#### Dependencies

This parameter appears when you set the value of the Determine number of random samplings using parameter to ```Specified value```.

Specify a percent desired confidence by entering a number between `0` and `100`. The value represents the probability of the algorithm to find the largest group of points that can be mapped by a transformation matrix.

#### Dependencies

This parameter appears when you set the Determine number of random samplings using parameter to ```Desired confidence```.

Specify an integer number for the maximum number of random samplings.

#### Dependencies

This parameter appears when you set the Method parameter to `Random Sample Consensus (RANSAC)` and you set the value of the Determine number of random samplings using parameter to `Desired confidence`.

Enable this parameter to stop random sampling when a percentage of input points have been found as inliers.

#### Dependencies

This parameter appears when you set the Method parameter to `Random Sample Consensus (RANSAC)`.

Specify whether to perform refinement on the transformation matrix.

#### Dependencies

This parameter appears when you select Find and exclude outliers check box.

Enable this parameter to output the inlier point pairs that were used to calculate the transformation matrix.

#### Dependencies

• This parameter appears when you select the Find and exclude outliers check box.

• The block will not use this parameter with signed or double, data type points.

Specify transformation matrix data type as `Single` or `Double` when the input points are built-in integers.

#### Dependencies

The block will not use this parameter with signed or double, data type points.

Enable this parameter to allow variable-sized signal input.

## Block Characteristics

 Data Types `double` | `integera` | `single` Multidimensional Signals `no` Variable-Size Signals `yes` a Generated code will be restricted to MATLAB host computers when you set the FFT implementation parameter to FFTW, or when the transform length is not a power of two.

## Algorithms

expand all

 R. Hartley and A. Ziserman, “Multiple View Geometry in Computer Vision,” Second edition, Cambridge University Press, 2003