0

I'm trying to use OpenCV to find the orientation/pose of a calibration checkerboard in a photo, so I'm using the solvePnPRansac function. I want to extract the board's axis system's orientation relative to the world system (ie. the angle between the board's x-axis and the world's X-axis). For this I was thinking of simply getting the Euler-angles out from the rotation matrix given by the solvePnPRansac/Rodrigues functions.

My question now is which notation convention does OpenCV's rotation matrix use? The 'x y z' notation or the 'x' notation (ie rotation around the z, x then the z axis again). I can't find this spec in the documentation and I need this information to know which equations to use to decompose the matrix into the proper Euler angles

Yassie
  • 316
  • 1
  • 4
  • 14
  • possible duplicate of [Rodrigues into Eulerangles and vice versa](http://stackoverflow.com/questions/12933284/rodrigues-into-eulerangles-and-vice-versa) – GPPK Feb 03 '15 at 12:57
  • I did see that question/answer before, but it does not answer the question I have. Please see http://mathworld.wolfram.com/EulerAngles.html to see what I mean by different Euler angle notations (more specifically around lines 3, 30 and 41) – Yassie Feb 03 '15 at 13:38
  • Euler angles are very different from the axis-angle representation used within the Rodrigues rotation formula. The former is comprised of three rotations around predetermined axes and those axes must be specified (xyz, zxz, ...). The latter is a compact notation that describes a single rotation around a single axis, and is not dependent on any specific rotation axes. – Hannes Ovrén Feb 03 '15 at 13:57
  • And you should probably avoid using Euler angles, unless you have very specific reasons to use them, since they are not unique, and have gimbal lock problems. – Hannes Ovrén Feb 03 '15 at 13:58
  • @HannesOvrén That's what I want to know. I have the rotation matrix in hand, but to get the Euler angles, I need to know the axis rotation order (xyz, zxz, etc. like you mentioned) which I can't seem to find specified anywhere. I just need to know the x, y and z axis angles relative to the world's XYZ axis system. Do you perhaps know of a better way to represent this? – Yassie Feb 03 '15 at 14:06
  • As I said: the output **is not Euler angles**. If you really want Euler angles you will have to convert the rotation vector to a rotation matrix using the `Rodrigues` function, and then convert the rotation matrix to Euler angles using whatever rotation order *you* want. – Hannes Ovrén Feb 03 '15 at 14:10
  • Ah ok, so to be clear, the rotation matrix stays the same regardless of the rotation order? My dynamics theory is a bit rusty – Yassie Feb 03 '15 at 14:17
  • Yes. The rotation matrix is a unique representation for rotations. – Hannes Ovrén Feb 03 '15 at 14:21

0 Answers0