Colorado School of Mines Computer Vision Professor William Hoff Dept of Electrical Engineering &Computer Science Colorado School of Mines Computer Vision http://inside.mines.edu/~whoff/ 1 3D Rotations Colorado School of Mines Computer Vision Topics • We have looked at how to represent 3D rotations using XYZ fixed angles • Here we will look at: – – – – Rotations using small angles Euler angle representation Axis-angle representation Quaternions Colorado School of Mines Computer Vision 3 XYZ Fixed Angles • Start with {B} coincident with {A}. First rotate {B} about xA by angle qX, then rotate it about yA by qY, then rotate about zA by qZ. A B RXYZ q X , qY , q Z RZ (q Z ) RY (qY ) RX (q X ) 0 cz sz 0 cy 0 sy 1 0 sz cz 0 0 1 0 0 cx sx 0 0 1 sy 0 cy 0 sx cx where cx cos(q X ), sy sin(qY ), etc cz cy A R q , q , q sz cy B XYZ X Y Z sy Each rotation takes place relative to the fixed frame {A} cz sy sx szcx cz sy cx sz sx sz sy sx czcx sz sy cx cz sx cy sx cy cx 4 Colorado School of Mines Computer Vision Small Angle Approximation • If rotation angles are small – Eg., object is rotating slowly in a video sequence – Or we are looking at the effect of small angle perturbations on the rotation • Then rotation matrix simplifies cos q Z cos qY A R q , q , q sin q Z z cos qY B XYZ X Y Z sin q Y cos q Z sin qY sin q X sin q Z cos q X sin q Z z sin qY sin q X cos q Z cos q X cos qY sin q X cos q Z sin qY cos q X sin q Z sin q X sin q Z sin qY cos q X cos q Z sin q X cos qY cos q X • Let cos q ≈ 1, sin q ≈ q for small q 1 A R q , q , q qZ B XYZ X Y Z q Y qZ 1 qX qY q X 1 5 Colorado School of Mines Computer Vision Possible Combinations for Rotations • There are 12 possible combinations for rotations about the fixed axes: – – – – – – – – – – – – RXRYRZ RXRZRY RYRXRZ RYRZRX RZRXRY RZRYRX RXRYRX RXRZRX RYRXRY RYRZRY RZRXRZ RZRYRZ Colorado School of Mines We will use this convention in this course • So for a given 3D rotation, the values of the 3 angles depends on the rotation convention you use • However, a given 3D rotation always has a unique rotation matrix Computer Vision 6 Euler angles – a different rotation convention • ZYX Euler angles – Start with {B} coincident with {A}. First rotate {B} about zB by angle qZ, then rotate it about yB by qY, then rotate about xB by qX. – Each rotation takes place relative to the moving frame {B} – There are 12 angle set conventions for Euler angles Colorado School of Mines Computer Vision 7 Equivalent Angle-Axis • k A general rotation can be expressed as a rotation q about an axis k k x k x vq cq Rk q k x k y vq k z sq k k vq k sq y x z k x k y vq k z sq k y k y vq cq k y k z vq k x sq k x k z vq k y sq k y k z vq k x sq k z k z vq cq where {B} cq cos q , sq sin q , vq 1 cos q T kˆ k , k , k x y q {A} z • The inverse solution (i.e., given a rotation matrix, find k and q): • The product of the unit vector k and angle q , w = q k = (wx, wy, wz) is a minimal representation for a 3D rotation r11 r22 r33 1 2 r32 r23 1 kˆ r r 13 31 2 sin q r21 r12 q acos Note that (-k,-q) is also a solution 8 Colorado School of Mines Computer Vision