Documentation Center

  • Trial Software
  • Product Updates

images.geotrans.PiecewiseLinearTransformation2D class

Package: images.geotrans

2-D piecewise linear geometric transformation

Description

An images.geotrans.PiecewiseLinearTransformation2D object encapsulates a 2-D piecewise linear geometric transformation.

Construction

tform = images.geotrans.PiecewiseLinearTransformation2D(movingPoints,fixedPoints) creates an images.geotrans.PiecewiseLinearTransformation2D object given m-by-2 matrices movingPoints and fixedPoints, which define matched control points in the moving and fixed images, respectively.

Properties

Dimensionality

Dimensionality of geometric transformation

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

Methods

images.geotrans.PiecewiseLinearTransformation2D.outputLimitsFind output limits of geometric transformation
images.geotrans.PiecewiseLinearTransformation2D.transformPointsInverseApply inverse geometric transformation

Copy Semantics

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

Examples

expand all

Fit set of control points related by affine transformation

Fit a piecewise linear transformation to a set of fixed and moving control points that are actually related by a single global affine2d transformation across the domain.

Create a 2D affine transformation.

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

  affine2d with properties:

                 T: [3x3 double]
    Dimensionality: 2

Arbitrarily choose 6 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)
movingPoints =

   13.3210   17.9597
   10.7163    3.1876
    2.4906    2.6071
    0.8682    4.9240
   -4.4031    3.8227
  -13.3210  -17.9597

Estimate piecewise linear transformation that maps movingPoints to fixedPoints.

tformPiecewiseLinear = images.geotrans.PiecewiseLinearTransformation2D(movingPoints,fixedPoints)
tformPiecewiseLinear = 

  PiecewiseLinearTransformation2D with properties:

    Dimensionality: 2

Verify the fit of our PiecewiseLinearTransformation2D object at the control points.

movingPointsComputed = transformPointsInverse(tformPiecewiseLinear,fixedPoints);
 
errorInFit = hypot(movingPointsComputed(:,1)-movingPoints(:,1),...
                   movingPointsComputed(:,2)-movingPoints(:,2))
errorInFit =

   1.0e-15 *

         0
         0
    0.4441
         0
         0
         0

See Also

|

Was this topic helpful?