Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

PiecewiseLinearTransformation2D

2-D piecewise linear geometric transformation

Description

A PiecewiseLinearTransformation2D object encapsulates a 2-D piecewise linear geometric transformation.

Creation

You can create a PiecewiseLinearTransformation2D object using the following methods:

Properties

expand all

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

Object Functions

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

Examples

expand all

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 the 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

Introduced in R2013b

Was this topic helpful?