Computer Vision – Exercise #1

Homography and Features

Due date: 22.04.2007

1)  Apply a projective transform to an image with Matlab (use the attached image castle.jpg, and one more image of your choice).

2)  Extract and match interest points from the pair of images from 1) using the SIFT detector and descriptor. Matlab code for extracting and matching can be found in: http://www.cs.ubc.ca/~lowe/keypoints/ .

3)  Implement the normalized DLT (Direct Linear Transformation) algorithm:

Objective

Given n≥4 2D to 2D point correspondences {xi↔xi’}, determine the 2D 3x3 homography matrix H such that xi’=Hxi (in homogenous coordinates).

Algorithm

(i)  Normalize points xi: First move their average to (0,0) by substracting their mean. Then scale them to average length of. The final transformation is: T= Tscale*Ttranslate

(ii)  Do the same to points xi’, and obtain the transformation T’

(iii)  For each correspondence xi ↔xi’ compute the matrix Ai (using the transformed points); see explanation and definitions below

(iv)  Assemble the n 2x9 matrices Ai into a single 2nx9 matrix A

(v)  Obtain the SVD of A. The unit singular vector corresponding to the smallest singular value is the solution h. Specifically, if A=UDVT with D diagonal with positive diagonal entries, arranged in descending order down the diagonal, then h is the last column of V

(vi)  Determine the homography H from h

(vii) Denormalize the solution: inv(T’)*H*T

(see “Multiple View Geometry in computer vision”, by R. Hartley and A. Zisserman, p. 92)

Use DLT to find the Homography between the images from 1), and compare to the true Homography.

4)  Use RANSAC to try to improve results (code can be find in the same place as below).

5)  Repeat (1)-(4) with the Harris corner detector. For the descriptor simply use the intensities of a local window around the interest point (try several sizes of a window). For matching modify match.m from the SIFT package. The code for Harris corner detector can be found in: http://www.csse.uwa.edu.au/~pk/research/matlabfns/

6)  Compare the results of SIFT and Harris for different parameters:

·  size of window in the Harris corner detector

·  distRatio in the SIFT matching (the ratio of distances between the furthest match that is accepted and the second best match, increase to get more matches)

·  different Homography matrices in 1)

Direct Linear Transformation (DLT):

(taken from “Multiple View Geometry in computer vision”, by R. Hartley and A. Zisserman, p. 71)

·  The homography is a 3x3 matrix, whose rows are ,,; it relates every pair of corresponding points , (equality up to scale) as

·  This equation may be expressed in terms of the vector cross product as

·  This gives a set of three equations on the entries of H (a 9-dimensional vector):

·  Only two equations are independent, therefore we omit the 3rd one:

and we re-write the two equations as Aih=0, for a 2x9 matrix Ai

·  Finally, we put n images together as:

Useful Matlab functions:

·  maketform. Note that it gets the homography matrix by transpose as in Matlab they multiply from left – xA and not Ax.

·  Imtransform

·  ransac and other Peter Kovesi’s Matlab code for vision: http://www.csse.uwa.edu.au/~pk/research/matlabfns/


two equation as from the SIFT package.to work