Convert 3-D rotation vector to rotation matrix
Convert Rotation Vector to Rotation Matrix
Create a vector representing a 90-degree rotation about the Z axis.
rotationVector = pi/2 * [0 0 1];
Find the equivalent rotation matrix.
rotationMatrix = rotvec2mat3d(rotationVector)
rotationMatrix = 3×3 0.0000 -1.0000 0 1.0000 0.0000 0 0 0 1.0000
rotationVector — Rotation vector
Rotation vector, specified 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.
rotationMatrix — Rotation of camera
Rotation of camera, returned as a 3-by-3 matrix that corresponds to the input axis-angle rotation vector.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version HistoryIntroduced in R2022b
R2022b: Recommended over
Starting in R2022b, most Computer Vision Toolbox™ functions create and perform geometric transformations using the premultiply
convention. However, the
rotationVectorToMatrix function uses the
postmultiply convention. Although there are no plans to remove
rotationVectorToMatrix at this time, you can streamline your
geometric transformation workflows by switching to the
function, which supports the premultiply convention. For more information, see Migrate Geometric Transformations to Premultiply Convention.