transformPointsInverse
应用反向几何变换
Syntax
描述
例子
应用二维几何变换的反变
Create anaffine2d
object 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
Transform Packed Coordinates Using Custom 2-D Transformation
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
应用3-D几何变换的反向转换
Create anaffine3d
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
应用向前变换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
Transform Packed Coordinates Using Custom 3-D Transformation
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
tform
—几何变换
几何转换对象
几何变换,指定为几何变换对象。
对于二维几何变换,tform
can be arigid2d
,affine2d
,Projective2d
,几何图2D
,LocalWeightedMeanTransformation2D
,PiecewiseLinearTransformation2D
, orpolyenmialtransformation2d
几何转换对象。
x
—x-coordinates of points to be transformed
m-经过-n或者m-经过-n-经过-pnumeric array
x-coordinates of points to be transformed, specified as anm-经过-n或者m-经过-n-经过-p数字阵列。尺寸的数量x
matches the dimensionality oftform
.
Data Types:single
|double
y
—y-coordinates of points to be transformed
m-经过-n或者m-经过-n-经过-pnumeric array
y-coordinates of points to be transformed, specified as anm-经过-n或者m-经过-n-经过-p数字阵列。的大小y
must match the size ofx
.
Data Types:single
|double
X
—要转换的点的坐标
l-经过-2或者l-经过-3numeric array
要转换的点的坐标, specified as anl-经过-2或者l-经过-3数字阵列。The number of columns ofX
matches the dimensionality oftform
.
The first column lists thex- 要转换的每个点的坐标,第二列列出了y-coordinate. Iftform
代表3D几何变换,X
has sizel-经过-3和the third column lists thez- 要转换点的共坐标。
Data Types:single
|double
Output Arguments
u
—x-coordinates of points after transformation
m-经过-n或者m-经过-n-经过-pnumeric array
x-coordinates of points after transformation, returned as anm-经过-n或者m-经过-n-经过-p数字阵列。尺寸的数量u
matches the dimensionality oftform
.
Data Types:single
|double
v
—y-coordinates of points after transformation
m-经过-n或者m-经过-n-经过-pnumeric array
y-coordinates of points after transformation, returned as anm-经过-n或者m-经过-n-经过-p数字阵列。的大小v
matches the size ofu
.
Data Types:single
|double
w
—z-coordinates of points after transformation
m-经过-n-经过-pnumeric array
z-coordinates of points after transformation, returned as anm-经过-n-经过-p数字阵列。的大小w
matches the size ofu
.
Data Types:single
|double
Version History
开放示例
You have a modified version of this example. Do you want to open this example with your edits?
matlab命令
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择一个网站
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
您还可以从以下列表中选择一个网站:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
美洲
- AméricaLatina(Español)
- 加拿大(英语)
- 美国(英语)