Main Content


(Not recommended) Convert 3-D rotation matrix to rotation vector

rotationMatrixToVector is not recommended. Use the rotmat2vec3d function instead. For more information, see Compatibility Considerations.



rotationVector = rotationMatrixToVector(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.


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 = rotationMatrixToVector(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


[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 R2016a

expand all