# Obtaining Euler angles from Rodrigues Rotation Matrix

Hi,

I wish to extract Euler angles from the rvec output parameter of cv::solvePnp.

I understand that 3x1 rvec needs to be passed on to the Rodrigues function to obtain the 3x3 rotation matrix.

But to obtain Euler Angles, I need to use a fixed convention ( see this , for example Z-Y-X,etc ) which requires the rotation matrix to be obtained from a permutation (fixed order) of multiplication of Matrices ,

eg: for Z-Y-X convention, R_resultant = Rz * Ry * Rx.

I have looked into the source code here for Rodrigues function but don't quite understand how the matrix is formed Hence -

My Question: What is the convention (Z-Y-X, X-Y-Z, etc) of the formation of the 3x3 Rotation matrix obtained from Rodrigues ? Without this information I cannot obtain Euler angles. I have seen this tutorial for real time pose estimation, but unfortunately I don't understand the assumption for the convention (and hence I had made another question for that - here).

edit retag close merge delete

Sort by » oldest newest most voted Good news! A rotation matrix is a rotation matrix is a rotation matrix. A rotation can be represented by several different conventions of euler angles, ex, the Z-X-Y, ect. However, if they represent the same rotation, the produce the same rotation matrix. It is different matrices multiplied together in a different order, but the same end result.

What that means for you, is that you can decompose the rotation matrix to your heart's content without worrying about how the Rodrigues function works.

more

Thanks for answering! you mean R_resultant = RxRyRz = RzRyRx = all other x,y,z permutations etc ?

Absolutely not. I mean R_resultant = Rx1Ry1Rz1 = Rz2Ry2Rx2 = ... Rx1 will not equal Rx2 and so forth.

You simply choose which set of euler angles to decompose it into, and then do so. Your question is wrong. The convention (Z-Y-X, X-Y-Z) is not in the formation of the rotation matrix, it is in the formation of the euler angles. The Rotation matrix is complete, with no convention, or assumptions, or extra information needed.

You can decompose the same rotation matrix into Z-Y-X euler angles, and X-Y-Z euler angles and every other type. The resulting angles will be different, but they are the same rotation.

Official site

GitHub

Wiki

Documentation