Starting in R2022b, most Computer Vision Toolbox™ functions create and perform geometric transformations using the
premultiply convention. However, the rotationMatrixToVector
function uses the postmultiply convention. Although there are no plans to remove
rotationMatrixToVector
at this time, you can streamline
your geometric transformation workflows by switching to the rotmat2vec3d
function, which supports the premultiply convention.
For more information, see
Migrate Geometric Transformations to Premultiply Convention.
To update your code:
Change instances of the function name
rotationMatrixToVector
to
rotmat2vec3d
.
Specify the rotation matrix as the transpose of the
rotationMatrix
argument of the
rotationMatrixToVector
function. Alternatively, you
can get a rotation matrix in the correct premultiply format by using the
estimateExtrinsics
function and querying the
R
property of the returned rigidtform3d
object.
The table shows examples of how to update your code.
Discouraged Usage | Recommended Replacement |
---|
This example converts a 3-D rotation matrix in the
postmultiply convention to a rotation vector using the
rotationMatrixToVector
function. | This example converts a 3-D rotation matrix in the
premultiply convention to a rotation vector using the
rotmat2vec2d function. The 3-D
rotation matrix is the transpose of
rotMatrixOld . |
This example obtains a 3-D rotation matrix in the
postmultiply convention using the
extrinsics function, then converts
the matrix to a rotation vector using the
rotationMatrixToVector
function. | This example obtains a 3-D rotation matrix in the
premultiply convention using the
estimateExtrinsics function, then
converts the matrix to a rotation vector using the
rotmat2vec2d
function. |