基于MATLAB link的相机校准的外在矩阵应该是4x3矩阵(包括方向和平移)意味着我们需要12个元素,但是,根据Tango documentation中的解释,我们只得到3个数字用于翻译和4个用于轮换的数字。如何用这7个数字创建4x3矩阵?
谢谢, 瓦希德。
答案 0 :(得分:0)
View Matrix用于保存这些值。它是一个4x4矩阵,允许操纵3D姿势(位置+方向)。
您可以在此处找到有关此矩阵的更多详细信息: http://www.3dgep.com/understanding-the-view-matrix/
请注意,Tango java库基于Rajawali 3D库。您可以在此处查看MatrixX44的结构:
特别是,以下方法显示了如何存储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;
}