Main Content

rigid3d

(非推奨) 右から乗算する規則を使用した 3 次元剛体幾何学的変換

R2020a 以降

rigid3d は推奨されません。代わりに、rigidtform3d オブジェクトを使用してください。詳細については、互換性の考慮事項を参照してください。

説明

rigid3d オブジェクトは、3 次元剛体幾何学的変換に関する情報を格納し、フォワード変換と逆変換を可能にします。

作成

説明

tform = rigid3d は、恒等変換に該当する既定の rigid3d オブジェクトを作成します。

tform = rigid3d(t) は、指定された 3 次元剛体変換行列 tT プロパティに設定します。

tform = rigid3d(rot,trans) は、指定された回転行列 rot および平行移動ベクトル trans を、それぞれ Rotation プロパティおよび Translation プロパティに設定します。

プロパティ

すべて展開する

フォワード剛体変換。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');

この例では、tformPost という名前の rigid3d オブジェクトから開始し、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);