Documentation

This is machine translation

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

PolynomialTransformation2D

2-D polynomial geometric transformation

Description

A PolynomialTransformation2D object encapsulates a 2-D polynomial geometric transformation.

Creation

You can create a PolynomialTransformation2D object using the following methods:

Properties

expand all

Polynomial coefficients used to determine U in the inverse transformation, specified as a vector of length n. For polynomials of degree 2, 3, and 4, n is 6, 10, and 15, respectively. The polynomial coefficient vector A is ordered as follows:

U = A(1) + A(2).*X + A(3).*Y + A(4).*X.*Y + A(5).*X.^2 + A(6).*Y.^2 +...

Data Types: double | single

Polynomial coefficients used to determine V in the inverse transformation, specified as a vector of length n. For polynomials of degree 2, 3, and 4, n is 6, 10, and 15, respectively. The polynomial coefficient vector B is ordered as follows:

V = B(1) + B(2).*X + B(3).*Y + B(4).*X.*Y + B(5).*X.^2 + B(6).*Y.^2 +...

Data Types: double | single

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

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

Object Functions

 outputLimits Find output spatial limits given input spatial limits transformPointsInverse Apply inverse geometric transformation

Examples

expand all

Fit a second degree polynomial transformation to a set of fixed and moving control points that are actually related by an 2-D affine transformation.

Create 2-D affine transformation.

theta = 10;
tformAffine = affine2d([cosd(theta) -sind(theta) 0; sind(theta) cosd(theta) 0; 0 0 1]);

Arbitrarily choose six pairs of control points. A second degree polynomial requires six pairs of control points.

fixedPoints = [10 20; 10 5; 2 3; 0 5; -5 3; -10 -20];

Apply forward geometric transformation to map fixed points to obtain effect of fixed and moving points that are related by some geometric transformation.

movingPoints = transformPointsForward(tformAffine,fixedPoints);

Estimate second degree PolynomialTransformation2D transformation that fits fixedPoints and movingPoints.

tformPolynomial = images.geotrans.PolynomialTransformation2D(movingPoints,fixedPoints,2);

Verify the fit of the PolynomialTransformation2D transformation at the control points.

movingPointsEstimated = transformPointsInverse(tformPolynomial,fixedPoints);
errorInFit = hypot(movingPointsEstimated(:,1)-movingPoints(:,1),...
movingPointsEstimated(:,2)-movingPoints(:,2))