Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Issue in OpenCV sample tutorial for real time pose estimation

Hi,

I was trying out the real time pose estimation tutorial from OpenCV ( this tutorial ), and while while looking into the source code, I may have found a (possible) inconsistency -

The functions for converting between Rotation Matrix and Euler Angles ( please see euler2rot and rot2euler from the C++ source code for the tutorial).

I am aware that there are 6-types of Tait-bryan angles (they are colloquially referred to as Euler Angles ).

My issue:

  • The above source code functions do not adhere to any of the 6 types. I checked a few sources to verify this - From the section on wikipedia page and even wrote a simple Matlab script using symbolic variables ( please see below, at the end of the question ).
  • The source code in the functions seems to correspond to the Y-Z-X Tait bryan angles, but with the pitch and yaw interchanged. Why is this the case ? (Does this have something to do with the fact that the camera's coordinate axes has z-facing forward, y-facing downward and x-facing right ? )
  • And finally, I think, Z-Y-X Tait Bryan angles are the industry standard for robotics , hence is there any particular reason for using Y-Z-X (with the pitch and yaw interchanged) ?

================= Matlab script below for reference ============

syms roll
syms pitch
syms yaw

Rx = [1 0 0; 0 cos(roll) -sin(roll); 0 sin(roll) cos(roll)];
Ry = [cos(pitch) 0 sin(pitch); 0 1 0; -sin(pitch) 0 cos(pitch)];
Rz = [cos(yaw) -sin(yaw) 0; sin(yaw) cos(yaw) 0; 0 0 1];

R_Y_Z_X = Ry * Rz * Rx

Output:

R_Y_Z_X =

[  cos(pitch)*cos(yaw), sin(pitch)*sin(roll) - cos(pitch)*cos(roll)*sin(yaw), cos(roll)*sin(pitch) + cos(pitch)*sin(roll)*sin(yaw)]
[             sin(yaw),                                   cos(roll)*cos(yaw),                                  -cos(yaw)*sin(roll)]
[ -cos(yaw)*sin(pitch), cos(pitch)*sin(roll) + cos(roll)*sin(pitch)*sin(yaw), cos(pitch)*cos(roll) - sin(pitch)*sin(roll)*sin(yaw)]

Issue in OpenCV sample tutorial for real time pose estimation

Hi,

I was trying out the real time pose estimation tutorial from OpenCV ( this tutorial ), and while while looking into the source code, I may have found a (possible) inconsistency -

The functions for converting between Rotation Matrix and Euler Angles ( please see euler2rot and rot2euler from the C++ source code for the tutorial).

I am aware that there are 6-types of Tait-bryan angles (they are colloquially referred to as Euler Angles ).

My issue:

  • The above source code functions do not not adhere to any of the 6 types. I checked a few sources to verify this - From the section on wikipedia page and even wrote a simple Matlab script using symbolic variables ( please see below, at the end of the question ).
  • The source code in the functions seems to correspond to the Y-Z-X Tait bryan angles, but with the pitch and yaw interchanged. Why is this the case ? (Does this have something to do with the fact that the camera's coordinate axes has z-facing forward, y-facing downward and x-facing right ? )
  • And finally, I think, Z-Y-X Tait Bryan angles are the industry standard for robotics , hence is there any particular reason for using Y-Z-X (with the pitch and yaw interchanged) ?

================= Matlab script below for reference ============

syms roll
syms pitch
syms yaw

Rx = [1 0 0; 0 cos(roll) -sin(roll); 0 sin(roll) cos(roll)];
Ry = [cos(pitch) 0 sin(pitch); 0 1 0; -sin(pitch) 0 cos(pitch)];
Rz = [cos(yaw) -sin(yaw) 0; sin(yaw) cos(yaw) 0; 0 0 1];

R_Y_Z_X = Ry * Rz * Rx

Output:

R_Y_Z_X =

[  cos(pitch)*cos(yaw), sin(pitch)*sin(roll) - cos(pitch)*cos(roll)*sin(yaw), cos(roll)*sin(pitch) + cos(pitch)*sin(roll)*sin(yaw)]
[             sin(yaw),                                   cos(roll)*cos(yaw),                                  -cos(yaw)*sin(roll)]
[ -cos(yaw)*sin(pitch), cos(pitch)*sin(roll) + cos(roll)*sin(pitch)*sin(yaw), cos(pitch)*cos(roll) - sin(pitch)*sin(roll)*sin(yaw)]

Issue in OpenCV sample tutorial for real time pose estimation

Hi,

I was trying out the real time pose estimation tutorial from OpenCV ( this tutorial ), and while while looking into the source code, I may have found a (possible) inconsistency -

The functions for converting between Rotation Matrix and Euler Angles ( please see euler2rot and rot2euler from the C++ source code for the tutorial).

I am aware that there are 6-types of Tait-bryan angles (they are colloquially referred to as Euler Angles ).

My issue:

  • The above source code functions do not adhere to any of the 6 types. I checked a few sources to verify this - From the section on wikipedia page and even wrote a simple Matlab script using symbolic variables ( please see below, at the end of the question ).
  • The source code in the functions seems to correspond to the Y-Z-X Tait bryan angles, but with the pitch and yaw interchanged. Why is this the case ? (Does this have something to do with the fact that the camera's coordinate axes has z-facing forward, y-facing downward and x-facing right ? )
  • And finally, I think, Z-Y-X Tait Bryan angles are the industry standard for robotics , hence is there any particular reason for using Y-Z-X (with the pitch and yaw interchanged) interchanged, as noticed above) ?

================= Matlab script below for reference ============

syms roll
syms pitch
syms yaw

Rx = [1 0 0; 0 cos(roll) -sin(roll); 0 sin(roll) cos(roll)];
Ry = [cos(pitch) 0 sin(pitch); 0 1 0; -sin(pitch) 0 cos(pitch)];
Rz = [cos(yaw) -sin(yaw) 0; sin(yaw) cos(yaw) 0; 0 0 1];

R_Y_Z_X = Ry * Rz * Rx

Output:

R_Y_Z_X =

[  cos(pitch)*cos(yaw), sin(pitch)*sin(roll) - cos(pitch)*cos(roll)*sin(yaw), cos(roll)*sin(pitch) + cos(pitch)*sin(roll)*sin(yaw)]
[             sin(yaw),                                   cos(roll)*cos(yaw),                                  -cos(yaw)*sin(roll)]
[ -cos(yaw)*sin(pitch), cos(pitch)*sin(roll) + cos(roll)*sin(pitch)*sin(yaw), cos(pitch)*cos(roll) - sin(pitch)*sin(roll)*sin(yaw)]

Issue in OpenCV sample tutorial for real time pose estimation

Hi,

I was trying out the real time pose estimation tutorial from OpenCV ( this tutorial ), and while while looking into the source code, I may have found a (possible) inconsistency -

The functions for converting between Rotation Matrix and Euler Angles ( please see euler2rot and rot2euler from the C++ source code for the tutorial).

I am aware that there are 6-types of Tait-bryan angles (they are colloquially referred to as Euler Angles ).

My issue:

  • The above source code functions do not adhere to any of the 6 types. I checked a few sources to verify this - From the section on wikipedia page and even wrote a simple Matlab script using symbolic variables ( please see below, at the end of the question ).
  • The source code in the functions seems to correspond to the Y-Z-X Tait bryan angles, but with the pitch and yaw interchanged. Why is this the case ? (Does this have something to do with the fact that the camera's coordinate axes has z-facing forward, y-facing downward and x-facing right ? )
  • And finally, I think, Z-Y-X Tait Bryan angles are the industry standard for robotics , hence is there any particular reason for using Y-Z-X (with the pitch and yaw interchanged, as noticed above) ?

================= Matlab script below for reference ============

syms roll
syms pitch
syms yaw

Rx = [1 0 0; 0 cos(roll) -sin(roll); 0 sin(roll) cos(roll)];
Ry = [cos(pitch) 0 sin(pitch); 0 1 0; -sin(pitch) 0 cos(pitch)];
Rz = [cos(yaw) -sin(yaw) 0; sin(yaw) cos(yaw) 0; 0 0 1];

R_Y_Z_X = Ry * Rz * Rx

Output:

R_Y_Z_X =

[  cos(pitch)*cos(yaw), sin(pitch)*sin(roll) - cos(pitch)*cos(roll)*sin(yaw), cos(roll)*sin(pitch) + cos(pitch)*sin(roll)*sin(yaw)]
[             sin(yaw),                                   cos(roll)*cos(yaw),                                  -cos(yaw)*sin(roll)]
[ -cos(yaw)*sin(pitch), cos(pitch)*sin(roll) + cos(roll)*sin(pitch)*sin(yaw), cos(pitch)*cos(roll) - sin(pitch)*sin(roll)*sin(yaw)]