0

MATLAB リンクに基づくカメラ キャリブレーションの外部行列は4x3 行列 (向きと平行移動を含む) である必要があります。これは、12 要素が必要であることを意味しますが、 Tango ドキュメントの説明に基づいて、平行移動には 3 つの数値、回転には 4 つの数値しか得られません。これらの 7 つの数字で 4x3 マトリックスを作成するにはどうすればよいですか?

ありがとう、ヴァヒド。

4

1 に答える 1

0

ビュー マトリックスは、これらの値を保持するために使用されます。これは、3D ポーズ (位置 + 向き) を操作できる 4x4 マトリックスです。

このマトリックスの詳細については、 http ://www.3dgep.com/understanding-the-view-matrix/ を参照してください。

Tango Java ライブラリは Rajawali 3D ライブラリに基づいていることに注意してください。ここで、その MatrixX44 の構造を確認できます。

https://github.com/Rajawali/Rajawali/blob/master/rajawali/src/main/java/org/rajawali3d/math/Matrix4.java

特に、次の方法は、7 つの値がどのように格納されるかを示しています。読みやすくするために、スケール ベクトルが (1,1,1) にあると仮定できます。

public Matrix4 setAll(@NonNull Vector3 position, @NonNull Vector3 scale, @NonNull Quaternion rotation) {
    // Precompute these factors for speed
    final double x2 = rotation.x * rotation.x;
    final double y2 = rotation.y * rotation.y;
    final double z2 = rotation.z * rotation.z;
    final double xy = rotation.x * rotation.y;
    final double xz = rotation.x * rotation.z;
    final double yz = rotation.y * rotation.z;
    final double wx = rotation.w * rotation.x;
    final double wy = rotation.w * rotation.y;
    final double wz = rotation.w * rotation.z;

    // Column 0
    m[M00] = scale.x * (1.0 - 2.0 * (y2 + z2));
    m[M10] = 2.0 * scale.y * (xy - wz);
    m[M20] = 2.0 * scale.z * (xz + wy);
    m[M30] = 0;

    // Column 1
    m[M01] = 2.0 * scale.x * (xy + wz);
    m[M11] = scale.y * (1.0 - 2.0 * (x2 + z2));
    m[M21] = 2.0 * scale.z * (yz - wx);
    m[M31] = 0;

    // Column 2
    m[M02] = 2.0 * scale.x * (xz - wy);
    m[M12] = 2.0 * scale.y * (yz + wx);
    m[M22] = scale.z * (1.0 - 2.0 * (x2 + y2));
    m[M32] = 0;

    // Column 3
    m[M03] = position.x;
    m[M13] = position.y;
    m[M23] = position.z;
    m[M33] = 1.0;
    return this;
}
于 2016-09-05T14:56:47.510 に答える