HW1: Projective Geometry and Homography

Zoƫ LaLena

Q2: Metric Rectification

Input images, input annotations and the results.

Input Image Annotated parallel lines on input image AAffine-Rectified Image
Image 1 Image 2 Image 3
Image 7 Image 8 Image 9
Image 13 Image 14 Image 15
Image 19 Image 20 Image 21
Image 19 Image 20 Image 21
Test lines on Input Image Test lines on Affine-Rectified Image Before After
Image 1 Image 2 0.9879, 0.9846 0.9998, 0.9999
Image 7 Image 8 0.7842, 0.9999 0.9999, 0.9999

Method

1) First we take the cross product between each of our pairs of points (each pair representing set of parallel lines in the world) to find the lines.

2) For each pair of parallel lines we then take the cross product between them to find the vanishing points.

3) We then take the results from step 2 and take the cross product between them to find the line at infinity.

4) We then build a Homography matrix H where H = [[1,0,0],[0,1,0],[r3]] and r3 is the normalized result of the cross product from step 3.

5) Then we can transform the image with H.

Q2: Metric Rectification

Input images, input annotations and the results.

Input Image Annotated perpendicular lines on input image Annotated perpendicular lines on Affine-Rectified Image Rectified Image
Image 1 Image 2 Image 2 Image 3
Image 7 Image 8 Image 9 Image 9
Image 7 Image 8 Image 9 Image 9
Image 7 Image 8 Image 9 Image 9
Image 7 Image 8 Image 9 Image 9
Test lines on Input Image Test lines on Affine-Rectified Imag Before After
Image 1 Image 2 0.6686, -0.04480 -0.02118, -0.0096
Image 7 Image 8 -0.1919, -0.1065 0.04607, 0.01075

Method

1) First we use our method from Q1 to transform our input images, and all the given points (4 pairs of perpendicular points, 8 points).

2) Then we take the cross product of each pair of points to get 4 lines.

3) We then use these lines to construct a Matrix, A, for SVD. A is [[line1[0] * line2[0], (line1[0] * line2[1] + line1[1] * line2[0])/2, line1[1] * line2[1]], [line3[0] * line4[0], (line3[0] * line4[1] + line3[1] * line4[0])/2, line3[1] * line4[1]]]

4) We take the last row of Vh, associated with the smallest singular value, to be our a,b, & c values for a projected conic at infinity.

Image 3

Where d=e=f=0 because the image is already affine rectified

5) Now that we have constructed the projected conic at infinity, do SVD on it and acquire H as follows.

Image 3

where σ1 and σ2 are the first 2 values in Σ from the SVD of the conic matrix.

6) Then we can transform the image with H.

Q3: Planar Homography from Point Correspondences

Input images, input annotations and the results.

Normal Image Perspective Image Annotated corners in Perspective Image Warped and Overlaid Image
Image 1 Image 2 Image 2 Image 3
Image 7 Image 8 Image 9 Image 9

Method

1) First we find four points in our base image (desk) to project onto, these will correspond to the 4 corners of the image we are projecting onto it (book).

2) We then build a matrix A for SVD where for each pair of points, where x1 is the desk and x2 is the book.

A = [[ -x1, -y1, -1, 0, 0, 0, x1*x2, y1*x2, x2], [ 0, 0, 0, -x1, -y1, -1, x1*y2, y1*y2, y2]]

3) Solving the SVD, we take the last row of Vh reshaped to a 3x3 to be our H matrix.

4) Then we can transform the book with H and place it onto the desk image.