Technische Universität München Fakultät für Informatik S. Ilic, S. Hinterstoisser, J. Vogel, A. O. Duliu S. Holzer SS 2011 Solution for Exercise Sheet 2 Thursday May 19, 2011 Exercises in 3D Computer Vision I Exercise 1 3D Rigid Transformations (Exemplary Solution) a) RR> = R> R = I or R−1 = R> det(R) = 1 The vectors r1 ,r2 ,r3 are orthogonal The determinant of a matrix from SO(3) must be 1. (The determinant of any orthogonal Matrix is either 1 or -1.) b) Rv = 3 X i=1 r11 r12 r13 ri · xi = x1 · r21 + x2 · r22 + x3 · r23 r31 r32 r33 The vectors r1 ,r2 ,r3 can be seen as basis vectors and applying a rotation as a linear combination of these vectors weighted by the components of v. c) r> 1 = R> = r > 2 > r3 R−1 d) 0 v = Tv = R t 0 1 x0 − t 1 x 1 = Rx + t 1 (1) Rx = 1 > 0 > 0 x x R (x − t) R −R> t v= = = 1 1 1 0 1 > R −R> t T−1 = 0 1 e) Euler Angles, Rodrigues angles, Quaternions. f) Because it ensures that the resultant matrix is a rotation, i.e. belongs to the SO3 group. Solution 2/ page 2 Exercise 2 Rotation representations (Exemplary Solution) a) Derivation of the 2D rotation formula for non-homogenous coordinates. (i) v = (x, y)> = (r cos(α), r sin(α))> , with r the lenght of v. (ii) 0 v = r cos(α + β) r sin(α + β) r cos(α) cos(β) − r sin(α) sin(β) = r sin(α) cos(β) + r cos(α) sin(β) x cos(β) − y sin(β) = y cos(β) + x sin(β) x cos(β) − sin(β) = y sin(β) cos(β) cos(β) − sin(β) v = sin(β) cos(β) Finally we end up with the rotation matrix for non homogeneous 2D points: cos(β) − sin(β) R= sin(β) cos(β) b) Derivation of the matrix representation for a given axis angle representation in non homogeneous coordinates. (i) We start the derivation by defining a plane perpendicular to the rotation vector bt. To achieve this, we create two basis vectors b1 and b2 . We set b2 = bt × p (2) to be a vector perpendicular to the rotation axis bt and the vector corresponding to the point p. The missing basis vector is now chosen to be the vector perpendicular to the rotation axis and the first basis vector b1 = b2 × bt = (bt × p) × bt (3) (4) Note that the order of the cross-products matters, since it affects the direction of the resulting vector and thus some signs during the further computation. Furthermore the brackets of the term including the triple cross-product matter as well, since the cross-product is not associative. To prove that b1 really represents the projection of p onto plane π, we take a look a the triangle created by the origin, the intersection of bt with the plane π 0 , and p (see figure below). As you can see, the triangle created by the origin, q, and p is congruent. If we want q to be the projection of p onto plane π, the length of b1 has to be |p| · sin(α). Since b2 is the cross product of bt and p, its length is sin(α) · |t| · |p|. The length of b1 is sin(90◦ ) · |b2 | · |t| = |p| · sin(α) as desired. Solution 2/ page 3 (ii) A rotation in a plane can be written as the linear combination of the basis vectors. In our case we want to rotate the projection of p into the plane spanned by b1 and b2 . The rotated point within the plane is computed as q0 = cos(θ)b1 + sin(θ)b2 (5) (iii) To finally retrieve the point p0 rotated around the axis bt by the angle θ, we need to lift up the point q0 to the same height as p. The offset vector o which has to be added to q0 is o = −b1 + p (6) So finally, our rotated point can be computed as: p0 = o + q0 = −b1 + p + cos(θ)b1 + sin(θ)b2 = p + (cos(θ) − 1)b1 + sin(θ)b2 = p + (cos(θ) − 1)((bt × p) × bt) + sin(θ)(bt × p) (7) (8) (9) (10) (iv) Expanding with the cross product properties: p0 = p + (cos(θ) − 1)(−bt × (bt × p)) + sin(θ)(bt × p) = p + (1 − cos(θ))[bt]× ([bt]× p) + sin(θ)[bt]× p = = p + (1 − cos(θ))[bt]2× p + sin(θ)[bt]× p (I + (1 − cos(θ))[bt]2× + sin(θ)[bt]× )p (11) (12) (13) (14) Solution 2/ page 4 (v) p0 = R · p (15) From equation (14) we can see that our desired rotation matrix is R(θ, bt) = I + (1 − cos(θ))[bt]2× + sin(θ)[bt]× . (16) This is also known as the Rodrigues formula for a rotation matrix. The so called axis times angle representation of a rotation is given by t = θbt, where the length of the rotation vector corresponds to the rotation angle in radians. (vi) The matrix corresponding to equation (16) can be written as: (1 − cos(θ))x2 + cos(θ) (1 − cos(θ))xy − z sin(θ) (1 − cos(θ))xz + y sin(θ) R(θ, bt) = (1 − cos(θ))xy + z sin(θ) (1 − cos(θ))y 2 + cos(θ) (1 − cos(θ))yz − x sin(θ) (1 − cos(θ))xz − y sin(θ) (1 − cos(θ))yz + x sin(θ) (1 − cos(θ))z 2 + cos(θ) (17) c) Derivation of the rotation matrices around the Euclidean coordinate frame with unit vector basis. Simply choosing as the rotation vectors the Euclidean unit vector basis e1 = (1, 0, 0)> , e2 = (0, 1, 0)> and e3 = (0, 0, 1)> and evaluation of equation (17) yields: 1 0 0 Rx (α) = 0 cos(α) − sin(α) 0 sin(α) cos(α) cos(β) 0 sin(β) 0 1 0 Ry (β) = − sin(β) 0 cos(β) cos(γ) − sin(γ) 0 Rz (γ) = sin(γ) cos(γ) 0 0 0 1