Ask Your Question

How can I get rotation-vector from Euler-angles?

asked 2016-02-25 03:05:56 -0600

AlexB gravatar image

updated 2016-02-25 03:07:23 -0600

If I have 3 Euler-angles then how can I get rotation-vector to use it for camera-rotation in OpenCV-viz3d?

I.e. how can I get Vec3d( X, Y, Z) from Euler-angles (alfa, betta, gamma) to use in this code?

viz::Viz3d viz_3d_window("Viz window");
cv::Affine3d pose = viz_3d_window.getViewerPose();
viz_3d_window.setViewerPose( pose.rotate( Vec3d( X, Y, Z) ) );


I can find Euler-angles from rotation-matrix by using RQDecomp3x3() or as shown in that question, but whether is there an inverse function in the OpenCV to find rotation-matrix from Euler-angles or better to find rotation-vector( Vec3d( X, Y, Z) )?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-02-25 04:05:46 -0600

Eduardo gravatar image

updated 2016-02-25 06:30:11 -0600

You can get the rotation vector from the rotation matrix directly with cv::Rodrigues.

If you have Euler angles, you can construct the corresponding rotation matrix according to the chosen convention.

An exemple of how the code looks like here: euler2rot for the Euler angles convention he chose.

edit flag offensive delete link more


But how can I construct the corresponding rotation matrix from Euler angles?

AlexB gravatar imageAlexB ( 2016-02-25 05:10:09 -0600 )edit

You already extracted the Euler angles from your rotation matrix with RQDecomp3x3(), just use your rotation matrix.

Eduardo gravatar imageEduardo ( 2016-02-25 06:56:02 -0600 )edit

Question Tools

1 follower


Asked: 2016-02-25 03:05:56 -0600

Seen: 8,865 times

Last updated: Feb 25 '16