This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

transformPointsInverse

Apply inverse geometric transformation

Syntax

[u,v] = transformPointsInverse(tform,x,y)
[u,v,w] = transformPointsInverse(tform,x,y,z)
U = transformPointsInverse(tform,X)

Description

example

[u,v] = transformPointsInverse(tform,x,y) applies the inverse transformation of 2-D geometric transformation tform to the points specified by coordinates x and y.

[u,v,w] = transformPointsInverse(tform,x,y,z) applies the inverse transformation of 3-D geometric transformation tform to the points specified by coordinates x, y, and z.

U = transformPointsInverse(tform,X) applies the inverse transformation of tform to the input coordinate matrix X and returns the coordinate matrix U. transformPointsInverse maps the kth point X(k,:) to the point U(k,:).

Examples

collapse all

Create an affine2d object that defines the transformation.

theta = 10;

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

  affine2d with properties:

                 T: [3x3 double]
    Dimensionality: 2

Apply forward transformation of 2-D geometric transformation to an input point.

[X,Y] = transformPointsForward(tform,5,10)
X =

    6.6605


Y =

    8.9798

Apply inverse transformation of 2-D geometric transformation to output point from the previous step to recover the original coordinates.

[U,V] = transformPointsInverse(tform,X,Y)
U =

    5.0000


V =

    10

Specify the packed (x,y) coordinates of five input points. The packed coordinates are stored in a 5-by-2 matrix, where the x-coordinate of each point is in the first column, and the y-coordinate of each point is in the second column.

XY = [10 15;11 32;15 34;2 7;2 10];

Define the inverse mapping function. The function accepts and returns points in packed (x,y) format.

inversefn = @(c) [c(:,1)+c(:,2),c(:,1)-c(:,2)]
inversefn = function_handle with value:
    @(c)[c(:,1)+c(:,2),c(:,1)-c(:,2)]

Create a 2-D geometric transform object, tform, that stores the inverse mapping function.

tform = geometricTransform2d(inversefn)
tform = 
  geometricTransform2d with properties:

        InverseFcn: @(c)[c(:,1)+c(:,2),c(:,1)-c(:,2)]
        ForwardFcn: []
    Dimensionality: 2

Apply the inverse geometric transform to the input points.

UV = transformPointsInverse(tform,XY)
UV = 5×2

    25    -5
    43   -21
    49   -19
     9    -5
    12    -8

Create an affine3d object that defines the transformation.

tform = affine3d([3 1 2 0;4 5 8 0;6 2 1 0;0 0 0 1])
tform = 

  affine3d with properties:

                 T: [4×4 double]
    Dimensionality: 3

Apply forward transformation of 3-D geometric transformation to an input point.

[X,Y,Z] = transformPointsForward(tform,2,3,5)
X =

    48


Y =

    27


Z =

    33

Apply inverse transformation of 3-D geometric transformation to output point from the previous step to recover the original coordinates.

[U,V,W] = transformPointsInverse(tform,X,Y,Z)
U =

    2.0000


V =

     3


W =

    5.0000

Specify the packed (x,y,z) coordinates of five input points. The packed coordinates are stored as a 5-by-3 matrix, where the first, second, and third columns contain the x-, y-, and z- coordinates,respectively.

XYZ = [5 25 20;10 5 25;15 10 5;20 15 10;25 20 15];

Define an inverse mapping function that accepts and returns points in packed (x,y,z) format.

inverseFcn = @(c) [c(:,1)+c(:,2),c(:,1)-c(:,2),c(:,3).^2];

Create a 3-D geometric transformation object, tform, that stores this inverse mapping function.

tform = geometricTransform3d(inverseFcn)
tform = 
  geometricTransform3d with properties:

        InverseFcn: @(c)[c(:,1)+c(:,2),c(:,1)-c(:,2),c(:,3).^2]
        ForwardFcn: []
    Dimensionality: 3

Apply the inverse transformation of this 3-D geometric transformation to the input points.

UVW = transformPointsInverse(tform,XYZ)
UVW = 5×3

    30   -20   400
    15     5   625
    25     5    25
    35     5   100
    45     5   225

Input Arguments

collapse all

Geometric transformation, specified as a geometric transformation object.

For 2-D geometric transformations, tform is an affine2d, projective2d, geometricTransform2d, LocalWeightedMeanTransformation2D, PiecewiseLinearTransformation2D, or PolynomialTransformation2D geometric transformation object.

For 3-D geometric transformations, tform is an affine3d object or geometricTransform3d geometric transformation object.

x-coordinates of points to be transformed, specified as an m-by-n or m-by-n-by-p numeric array. The number of dimensions of x matches the dimensionality of tform.

Data Types: single | double

y-coordinates of points to be transformed, specified as an m-by-n or m-by-n-by-p numeric array. The size of y must match the size of x.

Data Types: single | double

z-coordinates of points to be transformed, specified as an m-by-n-by-p numeric array. z is used only when tform is a 3-D geometric transformation. The size of z must match the size of x.

Data Types: single | double

Coordinates of points to be transformed, specified as an l-by-2 or l-by-3 numeric array. The number of columns of X matches the dimensionality of tform.

The first column lists the x-coordinate of each point to transform, and the second column lists the y-coordinate. If tform represents a 3-D geometric transformation, X has size l-by-3 and the third column lists the z-coordinate of the points to transform.

Data Types: single | double

Output Arguments

collapse all

x-coordinates of points after transformation, returned as an m-by-n or m-by-n-by-p numeric array. The number of dimensions of u matches the dimensionality of tform.

Data Types: single | double

y-coordinates of points after transformation, returned as an m-by-n or m-by-n-by-p numeric array. The size of v matches the size of u.

Data Types: single | double

z-coordinates of points after transformation, returned as an m-by-n-by-p numeric array. The size of w matches the size of u.

Data Types: single | double

Coordinates of points after transformation, returned as a numeric array. The size of U matches the size of X.

The first column lists the x-coordinate of each point after transformation, and the second column lists the y-coordinate. If tform represents a 3-D geometric transformation, the third column lists the z-coordinate of the points after transformation.

Data Types: single | double

Introduced in R2013a