16-822 Geometry-based Methods for Vision

16-822
Geometry-based Methods for Vision - Assignment 1
Sravan Chittupalli (schittup)    

Q1. Affine Rectification

   

Image 1 - chess5

Input Image Annotated parallel lines on input image Affine Rectified Image

Angles Evaluated on 2 pairs of test lines before and after affine rectification:

Before Rectification After Rectification
-0.9878 -0.99977
0.98459 0.99999

Test Lines before and after affine rectification:

Before Rectification After Rectification
   

Image 2 - tiles5

Input Image Annotated parallel lines on input image Affine Rectified Image

Angles Evaluated on 2 pairs of test lines before and after affine rectification:

Before Rectification After Rectification
0.98683 0.99992
0.998719 0.999938

Test Lines before and after affine rectification:

Before Rectification After Rectification
   

Image 3 - facade

Input Image Annotated parallel lines on input image Affine Rectified Image

Angles Evaluated on 2 pairs of test lines before and after affine rectification:

Before Rectification After Rectification
0.784232 0.999997
0.999978 0.999986

Test Lines before and after affine rectification:

Before Rectification After Rectification
   

Image 4 - my_image1

Input Image Annotated parallel lines on input image Affine Rectified Image

Angles Evaluated on 2 pairs of test lines before and after affine rectification:

Before Rectification After Rectification
0.992918 0.99999
0.99448 0.9883

Test Lines before and after affine rectification:

Before Rectification After Rectification
   

Image 5 - my_image2

Input Image Annotated parallel lines on input image Affine Rectified Image

Angles Evaluated on 2 pairs of test lines before and after affine rectification:

Before Rectification After Rectification
0.9983140 0.99975
0.99920 0.999995

Test Lines before and after affine rectification:

Before Rectification After Rectification
   

Implementation Description

Affine rectification is a process used to remove projective distortion from an image, preserving parallelism but not necessarily angles or distances. This is how I affine rectified the images given:

  • Identify vanishing lines in the distorted image i.e annotate the lines in the image that we know for sure are parallel in real world. We need atleast 2 pairs of parallel lines.
  • Compute the transformation matrix that maps the vanishing line to the line at infinity. The H matrix can be constructed as:
  • Figure : Affine rectification matrix
  • Apply this transformation to the entire image.
  •    

    Q2. Metric Rectification

       

    Image 1 - chess5

    Input Image Annotated perpendicular lines on input image Annotated perpendicular lines on affine
    Rectified Image
    Rectified Image

    Angles Evaluated on 2 pairs of test lines before and after metric rectification:

    Before Rectification After Rectification
    -0.66858 0.02118
    0.044795 0.0096

    Test Lines before and after metric rectification:

    Before Rectification After Rectification
       

    Image 2 - tiles5

    Input Image Annotated perpendicular lines on input image Annotated perpendicular lines on affine
    Rectified Image
    Rectified Image

    Angles Evaluated on 2 pairs of test lines before and after metric rectification:

    Before Rectification After Rectification
    -0.167718 0.0080
    -0.03498 0.0293

    Test Lines before and after metric rectification:

    Before Rectification After Rectification
       

    Image 3 - facade

    Input Image Annotated perpendicular lines on input image Annotated perpendicular lines on affine
    Rectified Image
    Rectified Image

    Angles Evaluated on 2 pairs of test lines before and after metric rectification:

    Before Rectification After Rectification
    0.1918709 -0.04607
    -0.106548 0.0107468

    Test Lines before and after metric rectification:

    Before Rectification After Rectification
       

    Image 4 - my_image1

    Input Image Annotated perpendicular lines on input image Annotated perpendicular lines on affine
    Rectified Image
    Rectified Image

    Angles Evaluated on 2 pairs of test lines before and after metric rectification:

    Before Rectification After Rectification
    -0.200391 -0.00635
    0.0861193 0.03268

    Test Lines before and after metric rectification:

    Before Rectification After Rectification
       

    Image 4 - my_image1

    Input Image Annotated perpendicular lines on input image Annotated perpendicular lines on affine
    Rectified Image
    Rectified Image

    Angles Evaluated on 2 pairs of test lines before and after metric rectification:

    Before Rectification After Rectification
    0.258323 0.04449
    0.582444 0.10568

    Test Lines before and after metric rectification:

    Before Rectification After Rectification
       

    Implementation Description

    Metric rectification is the process of removing affine distortions from an already affine-rectified image to restore metric properties such as angles and length ratios. This is the process I followed to metric rectify the affine rectified image:

  • Start with an affine-rectified image where parallel lines are already preserved.
  • Identify two pairs of orthogonal lines in the affine-rectified image.
  • We know this constraint that is created by perpendicular lines:

    Figure
    As the the image is already affine rectified d = e = f = 0
  • Use these orthogonal line pairs to compute the transformation matrix that will restore metric properties.
  • This was done by constructing a system of equations using the following constraint:

    Figure
    The s is a 3-vector and this lies in the null space of the above matrix. The s vector is calculated using SVD on the above matrix and choosing the vector formed by the last column of V
  • Apply this transformation to the affine-rectified image.

  • The resulting image will have real world perpendicular lines remaining perpendicular in the image.

       

    Q3. Planar Homography from Point Correspondences

       

    Image 1 - desk

    Input Image Perspective Image Annotated corners in Perspective Image Warped and Overlaid Image
       

    Image 2 - billboard

    Input Image Perspective Image Annotated corners in Perspective Image Warped and Overlaid Image
       

    Implementation Description

    Given 4 2D to 2D point correspondences we can find an homography relating the 2 images. The equation can be expressed as a cross product:

    Figure
    Given a set of 3 equations in the entries of H, it can be written in the form

    Figure
    We need 4 point to point coorespondences as h is a 9x1 vector with 8DoF and the 3x9 matrix has only 2 linearly independent vectors.
    h lies in the null space of the matrix. This is calculated by taking the SVD of the matrix and selecting the last column of the V vector. The h is rearranged into a 3x3 vector. This homography is used to map the normal-image onto the perspective-image.

       

    Q5. More Planar Homography from Point Correspondences (Bonus)

       

    Input Images

    Perspective Image Input Image 1 Input Image 2 Input Image 3 Input Image 4
       

    Output Image

    Figure : Q5 Output
       

    Implementation Description

    This part is very similar to Q3 implementation. Instead of doing it for one normal-image to one perspective image we do the same process for 4 normal-images and 1 perspective-image.