主要内容

transformPointsInverse

应用反向几何变换

描述

example

[u,v] = transformpointsinverse(tform,x,y)应用的逆变换2-D geometric transformationtformto the points specified by coordinatesxy.

[u,v,w] = transformpointsinverse(tform,x,y,z)应用3-D几何变换的反变tformto the points specified by coordinatesx,y, 和z.

U= transformpointsinverse(tform,X)应用的逆变换tformto the input coordinate matrixX和returns the coordinate matrixU.transformPointsInversemaps thekth pointX(k,:)U(k,:).

例子

全部收缩

Create anaffine2dobject that defines the transformation.

theta = 10;tform = extine2d([[cosd(theta)-sind(theta)0; sind(theta)cosd(theta)0; 0 0 1])
tform= affine2d with properties: T: [3x3 double] Dimensionality: 2

将2D几何转换的正向转换应用于输入点。

[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 thex-coordinate of each point is in the first column, and they-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)]

创建一个二维几何变换对象,tform,存储逆映射函数。

tform =几何图transform2d(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×225 -5 43 -21 49 -19 9 -5 12 -8

Create anaffine3dobject 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

应用向前变换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 thex- ,,y- ,,和z-坐标分别。

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

定义一个接收并返回包装中点的逆映射函数(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,该存储此逆映射函数。

tform = geometrictransform3d(inverseFCN)
tform =具有属性的deemogetrictransform3d:inversefcn: @(c)[c(::,1)+c(:,2),c(:,1)-c(:,2),c(:,3)。^2] forwardfcn:[]维度:3

将此3-D几何转换的反变形应用于输入点。

uvw = transformpointsinverse(tform,xyz)
UVW =5×330 -20 400 15 5 625 25 5 25 35 5 100 45 5 225

Input Arguments

全部收缩

几何变换,指定为几何变换对象。

对于二维几何变换,tformcan be arigid2d,affine2d,Projective2d,几何图2D,LocalWeightedMeanTransformation2D,PiecewiseLinearTransformation2D, orpolyenmialtransformation2d几何转换对象。

对于3D几何变换,tform可以是一个affine3d,rigid3d, or几何图形3D几何转换对象。

x-coordinates of points to be transformed, specified as anm-经过-n或者m-经过-n-经过-p数字阵列。尺寸的数量xmatches the dimensionality oftform.

Data Types:single|double

y-coordinates of points to be transformed, specified as anm-经过-n或者m-经过-n-经过-p数字阵列。的大小ymust match the size ofx.

Data Types:single|double

z-coordinates of points to be transformed, specified as anm-经过-n-经过-p数字阵列。zis used only whentformis a 3-D geometric transformation. The size ofzmust match the size ofx.

Data Types:single|double

要转换的点的坐标, specified as anl-经过-2或者l-经过-3数字阵列。The number of columns ofXmatches the dimensionality oftform.

The first column lists thex- 要转换的每个点的坐标,第二列列出了y-coordinate. Iftform代表3D几何变换,Xhas sizel-经过-3和the third column lists thez- 要转换点的共坐标。

Data Types:single|double

Output Arguments

全部收缩

x-coordinates of points after transformation, returned as anm-经过-n或者m-经过-n-经过-p数字阵列。尺寸的数量umatches the dimensionality oftform.

Data Types:single|double

y-coordinates of points after transformation, returned as anm-经过-n或者m-经过-n-经过-p数字阵列。的大小vmatches the size ofu.

Data Types:single|double

z-coordinates of points after transformation, returned as anm-经过-n-经过-p数字阵列。的大小wmatches the size ofu.

Data Types:single|double

转换后的点坐标,作为数字阵列返回。的大小Umatches the size ofX.

The first column lists thex-coordinate of each point after transformation, and the second column lists they-coordinate. Iftform代表3D几何变换,the third column lists thez- 转换后点的共坐标。

Data Types:single|double

Version History

在R2013a中引入

See Also

|