程序案例-E4850

CS-E4850 Computer Vision Exercise Round 6 The problems should be solved before the exercise session and solutions returned via the MyCourses page in a single PDF file. Handwritten solutions are fine if they are scanned to PDF format and clear to read. Exercise 1. Least-squares fitting for affine transformations. (pen & paper problem) A brief overview of affine transformation estimation is presented on slides 17-19 of Lecture 5. Present a derivation and compute an example by performing the following stages: a) Compute the gradient of the least squares error E = ∑n i=1 ||x′i Mxi t||2 with respect to the parameters of the transformation (i.e. elements of matrix M and vector t). b) Show that by setting the aforementioned gradient to zero you will get an equation of the form Sh = u, where vector h contains the unknown parameters of the transformation, and 6×6 matrix S and 6×1 vector u depend on the coordinates of the point correspondences {x′i,xi}, i = 1, . . . , n. c) Thus, one may solve the transformation by computing h = S 1u. Compute the affine transformation from the following point correspondences {(0, 0) → (1, 2)}, {(1, 0)→ (3, 2)}, and {(0, 1)→ (1, 4)}. (Hint: This calculation can be done with pen and paper but you may check the cor- rect answer by running the function affinefit given for the third exercise round in Exercise03.zip. Another way to check the answer is to draw the point corre- spondences on paper and visually determine the correct solution.) Tasks continue on the next page… 1 Exercise 2. Similarity transformation from two point correspondences. (pen & paper) A similarity transformation consists of rotation, scaling and translation and is defined in two dimensions as follows: x′ = sRx+ t ( x′ y′ ) = s ( cos(θ) sin(θ) sin(θ) cos(θ) )( x y ) + ( tx ty ) (1) Describe a method for solving the parameters s, θ, tx, ty of a similarity transformation from two point correspondences {x1 → x′1}, {x2 → x′2} using the following stages: a) Compute the vectors v′ = x′2 x′1 and v = x2 x1 and present a formula to recover the rotation angle θ from the corresponding unit vectors. b) Compute the scale factor s as the ratio of the norms of vectors v′ and v. c) After solving s and θ compute t using equation (1) and either one of the two point correspondences. d) Use the procedure to compute the transformation from the following point corre- spondences: {(1 2 , 0)→ (0, 0)}, {(0, 1 2 )→ ( 1, 1)}. (Hint: Drawing the point correspondences on a grid paper may help you to check your answer.) Demo 1. Matlab demo of panoramic image stitching. (Just a demo, no points given) Matlab Computer Vision System toolbox, which is included in Aalto’s Matlab and avail- able to students via download.aalto.fi, contains an example that demonstrates robust feature-based panorama stitching, which was covered during the Lecture 5 (i.e. SURF feature extraction and matching and RANSAC based homography estimation). Check the example by running the script FeatureBasedPanoramicImageStitchingExample.m, which is built-in to the aforementioned toolbox. Homography estimation is also covered in Chapter 4 of the book by Hartley & Zisserman. Demo 2. Properties of rotations and reflections. (Teacher will present, no points given) Isometries are transformations that preserve distances. An isometry is presented as x′y′ 1 = cos(θ) sin(θ) tx sin(θ) cos(θ) ty 0 0 1 xy 1 = (U t 0 1 ) xy 1 , (2) where = ±1. If = 1, the isometry is orientation-preserving. If = 1, the isometry is orientation-reversing. a) Show thatU is a pure rotation when = 1 and a composition of rotation and reflection when = 1. b) Show that detU = . c) Show that U is orthogonal, i.e. U>U = I. d) Show that the orientation-preserving isometries form a group under the operation of matrix multiplication. 2