2016-08-22 41 views
0

基礎上,MATLAB link攝像機標定外在矩陣應該是4×3矩陣(包括定向和翻譯)意味着我們需要12元,但是,基於在Tango documentation的解釋,我們只得到翻譯3號和4號進行旋轉。我如何用這7個數字創建4x3矩陣?探戈相機外部參數

謝謝, Vahid。

回答

0

查看矩陣用於保存這些值。這是一個4x4矩陣,允許操縱3D姿勢(位置+方位)。

你可以找到更多有關的細節在這份矩陣: http://www.3dgep.com/understanding-the-view-matrix/

注意,探戈Java庫是基於拉賈瓦利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; 
}