Main Content

images.geotrans.PolynomialTransformation2D

2-D polynomial geometric transformation

Description

A PolynomialTransformation2D object stores information about a 2-D polynomial geometric transformation and enables inverse transformations.

Creation

You can create a PolynomialTransformation2D object in these ways.

  • The fitgeotform2d function, which estimates a geometric transformation that maps pairs of control points between two images.

  • The images.geotrans.PolynomialTransformation2D function described here. This function creates a PolynomialTransformation2D object using coordinates of fixed points and moving points, or the known polynomial coefficients for the forward and inverse transformation.

Description

tform = images.geotrans.PolynomialTransformation2D(movingPoints,fixedPoints,degree) creates a PolynomialTransformation2D object and sets the Degree property. The function estimates the polynomial coefficients that map control points in the moving image, movingPoints, to control points in the fixed image, fixedPoints. You can select control points using the cpselect function.

example

tform = images.geotrans.PolynomialTransformation2D(a,b) creates a PolynomialTransformation2D object and sets the A and B properties using the specified polynomial coefficients.

Input Arguments

expand all

Control points in the moving image, specified as an m-by-2 matrix. Each row specifies the (x, y) coordinate of a control point.

Data Types: double | single

Control points in the fixed image, specified as an m-by-2 matrix. Each row specifies the (x, y) coordinate of a control point.

Data Types: double | single

Properties

expand all

Polynomial coefficients used to determine U in the inverse transformation, specified as an n-element vector. For polynomials of degree 2, 3, and 4, n is 6, 10, and 15, respectively.

Data Types: double | single

Polynomial coefficients used to determine V in the inverse transformation, specified as an n-element vector. For polynomials of degree 2, 3, and 4, n is 6, 10, and 15, respectively.

Data Types: double | single

Degree of the polynomial transformation, specified as the number 2, 3, or 4.

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

Object Functions

outputLimitsFind output spatial limits given input spatial limits
transformPointsInverseApply inverse geometric transformation

Examples

collapse all

A second degree polynomial requires six pairs of control points. Choose six pairs of control points and moving points. For simplicity, this example selects moving points that are translated 5 pixels horizontally and 10 pixels vertically from the fixed points.

fixedPoints = [10 20; 10 5; 2 3; 0 5; -5 3; -10 -20];
movingPoints = [15 30; 15 15; 7 13; 5 15; 0 13; -5 -10];

Estimate a second degree polynomial transformation that fits fixedPoints and movingPoints.

tformPolynomial = images.geotrans.PolynomialTransformation2D(movingPoints,fixedPoints,2)
tformPolynomial = 
  PolynomialTransformation2D with properties:

    Dimensionality: 2
            Degree: 2
                 A: [1.1102e-16 1.0000 8.1148e-17 3.1692e-15 -6.0409e-16 -1.4638e-15]
                 B: [1.1842e-16 -8.6803e-16 1.0000 5.5598e-15 -5.2617e-16 -2.6535e-15]

Verify that the inverse transformation maps the fixed points to the moving points.

movingPointsEstimated = transformPointsInverse(tformPolynomial,fixedPoints)
movingPointsEstimated = 6×2

   15.0000   30.0000
   15.0000   15.0000
    7.0000   13.0000
    5.0000   15.0000
    0.0000   13.0000
   -5.0000  -10.0000

More About

expand all

Version History

Introduced in R2013b