Main Content

rotmat2vec3d

Convert 3-D rotation matrix to rotation vector

Since R2022b

    Description

    example

    rotationVector = rotmat2vec3d(rotationMatrix) returns an axis-angle rotation vector that corresponds to the input 3-D rotation matrix. The function uses the Rodrigues formula for the conversion.

    Examples

    collapse all

    Create a matrix representing a 90-degree rotation about the Z axis.

    rotationMatrix = [0 -1 0; 1 0 0; 0 0 1];

    Find the equivalent rotation vector.

    rotationVector = rotmat2vec3d(rotationMatrix)
    rotationVector = 1×3
    
             0         0    1.5708
    
    

    Input Arguments

    collapse all

    Rotation of camera, specified as a 3-by-3 matrix. You can obtain this matrix by using the estimateExtrinsics function.

    Output Arguments

    collapse all

    Rotation vector, returned as a three-element vector. The vector represents the axis of rotation in 3-D, where the magnitude corresponds to the rotation angle in radians.

    Data Types: single | double

    References

    [1] Trucco, Emanuele, and Alessandro Verri. Introductory Techniques for 3-D Computer Vision. Upper Saddle River, NJ: Prentice Hall, 1998.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2022b

    expand all