CS 194-26 Spring 2020 Project 5A: Image Warping and Mosaicing

By: Annie Nguyen

Shooting the pictures

I used the pictures I took on vacation in Porto, Portugal for the rectification part of the project. The first is the facade of a famous bookstore, Livraria Lello, which is where JK Rowling got inspiration for Harry Potter when she was living in Porto. The second is a wall of Sao Bento station that is famous for their blue tiles. For the image mosaicing, I took pictures of my neighborhood, my bedroom, and my cat.

Livraria Lello
Sao Bento Station
Left
Right
Left
Right
Left
Right

Recover Homographies

Using n point correspondences from two images, I computed the entries to the 3x3 matrix H by setting up a linear system of 2*n equations. A * h = b. Then, I reshaped h to be a 3x3 matrix, H, and used this to find the coordinates that each input pixel would map to after being warped.

Warp the Images

First, I warped the corners of the image using the homography to see how big the output image needed to be. Also, this calculates the offsets needed to translate pixels in the second image space to the resulting image space. Then I took all the pixel coordinates within the corners in the resulting image space and applied inverse warping so that there weren't any holes in the resultting image. What this means is that each coordinate in the resulting image has a corresponding coordinate in the input image which can be calculated using Inv(H).

Image Rectification

For the Livraria Lello picture, I chose point correspondences so that the front face of the building is frontal-parallel. For the Sao Bento station picture, I chose point correspondences on the four courner of the colorful top banner, so that the banner would be frontal-parallel. Here are my results for image rectification and cropped to the area of interest:

Livraria Lello
Livraria Lello Rectified
Sao Bento
Sao Bento Rectified
Zoomed in

Blending the images into a mosaic

I warped the right image onto the left image. With that warp, I found the offset that the left image needed to be at. I offset the left image, leaving it unwarped. Then I combined the offset left image and the warped right image by placing the warped right image on top of the offset left image.
Left
Right
Offset Left
Warped Right
Mosaic
Left
Right
Offset Left
Warped Right
Mosaic
Left
Right
Offset Left
Warped Right
Mosaic
Left
Right
Offset Left
Warped Right
Mosaic