Main Content

rigid3d

(不推荐)使用后乘约定的三维刚性几何变换

自 R2020a 起

不建议使用 rigid3d。请改用 rigidtform3d 对象。有关详细信息,请参阅兼容性注意事项

说明

rigid3d 对象存储有关三维刚性几何变换的信息,并支持正向变换和逆变换。

创建对象

描述

tform = rigid3d 创建对应于恒等变换的默认 rigid3d 对象。

tform = rigid3d(t)T 属性设置为指定的三维刚性变换矩阵 t

示例

tform = rigid3d(rot,trans)RotationTranslation 属性分别设置为指定的旋转矩阵 rot 和平移向量 trans

属性

全部展开

正向刚性变换,指定为 4×4 数值矩阵。此矩阵必须为满足由下式给出的后乘约定的齐次变换矩阵:

[xyz1]=[uvw1]*T

T 的形式为

[r11r12r130;...r21r22r230;...r31r32r330;...txtytz1];

数据类型: single | double

变换的旋转分量,指定为 3×3 数值矩阵。此旋转矩阵满足由下式给出的后乘约定:

[xyz]=[uvw]*R

数据类型: single | double

变换的平移分量,指定为一个包含 3 个元素的数值行向量。此平移向量满足由下式给出的约定:

[xyz]=[uvw]+t

数据类型: single | double

此 属性 为只读。

几何变换的维度,指定为值 3

对象函数

invertInvert geometric transformation
outputLimitsFind output spatial limits given input spatial limits
transformPointsForwardApply forward geometric transformation
transformPointsInverseApply inverse geometric transformation

示例

全部折叠

以度为单位指定旋转角度,并创建一个 3×3 旋转矩阵。

theta = 30;
rot = [ cosd(theta) sind(theta) 0; ...
       -sind(theta) cosd(theta) 0; ...
       0 0 1];

分别指定水平、垂直和深度方向的平移量。

trans = [2 3 4];

创建一个执行旋转和平移的 rigid3d 对象。

tform = rigid3d(rot,trans)
tform = 
  rigid3d with properties:

       Rotation: [3x3 double]
    Translation: [2 3 4]

扩展功能

版本历史记录

在 R2020a 中推出

全部折叠

R2022b: 不推荐

从 R2022b 开始,大多数 Image Processing Toolbox™ 函数都使用前乘约定来创建和执行几何变换。因此,不推荐使用 rigid3d 对象,因为它使用后乘约定。虽然当前没有删除 rigid3d 对象的计划,但您可以通过切换到支持前乘约定的 rigidtform3d 对象来简化几何变换工作流。有关详细信息,请参阅Migrate Geometric Transformations to Premultiply Convention

要更新您的代码,请执行以下操作:

  • 将函数名称 rigid3d 的实例更改为 rigidtform3d

  • 将变换矩阵指定为 T 的转置,或将旋转矩阵指定为 Rotation 的转置。Trigid3d 对象的 T 属性的值,或用于创建 rigid3d 对象的变换矩阵。Rotationrigid3d 对象的 Rotation 属性的值,或用于创建 rigid3d 对象的旋转矩阵。

不推荐使用推荐的替代项

此示例基于后乘约定中的变换矩阵 T 创建一个 rigid3d 对象。

T = [1 0 0 0; 0 1 0 0; 0 0 1 0; 5 10 -5 1];
tformPost = rigid3d(T);

此示例基于矩阵 T 的转置创建一个 rigidtform3d 对象。

T = [1 0 0 0; 0 1 0 0; 0 0 1 0; 5 10 -5 1];
tform = rigidtform3d(T');

此示例从一个名为 tformPostrigid3d 对象开始,并基于 tformPostT 属性的转置创建一个 rigidtform3d 对象。

T = tformPost.T;
tform = rigidtform2d(T');

此示例基于后乘约定中的旋转矩阵 rot 和平移 trans 创建一个 rigid3d 对象。

theta = 30;
rot = [ cosd(theta) sind(theta) 0; ...
       -sind(theta) cosd(theta) 0; ...
        0 0 1];
trans = [5 10 -5];
tformPost = rigid3d(rot,trans);

此示例基于旋转矩阵 rot 的转置和平移 trans 创建一个 rigidtform3d 对象。

theta = 30;
rot = [ cosd(theta) sind(theta) 0; ...
       -sind(theta) cosd(theta) 0; ...
        0 0 1];
trans = [5 10 -5];
tform = rigidtform3d(rot',trans);