For this project, we used homographies to perform image rectification and create mosaics.

Part 1: Image Rectification

For this part of the project, I took pictures of a book and some art on a wall at an angle. I wanted to warp these images to show the book cover taken from a top down view without an angle, and the wall art also taken from the front without an angle. Essentially, the text shouldn't look too slanted or skewed on the book or wall art. To do this, we wanted to recover the homography matrix H, where the relation between p and p' is Hp = p', p are the original points on the image, and p' are the specified destination points of the image. H has 8 degrees of freedom, so by choosing 4 points and 4 destination points p', we have enough information to set up a linear system and solve for H. Then, I used inverse warping to get the resulting pixel values in the output image.

Part 2: Mosaics

To capture the pictures for mosaics, we wanted to try to keep our camera steady and only rotate around one axis to take the pictures (essentially, we didn't want our camera to move in world coordinates, only rotate about its current world coordinate). This way, we can account for a projective transformation between the photos and use the homography matrix to warp from one image to a position that aligns with the second image. To do this, we used a similar technique mentioned in part 1 of image rectification, choosing more than 4 points and solving for H using linear least squares.

To create each mosaic, I took 2 pictures. Using the solved H, I decided to warp my left image to the position that would align with the right image. Then, I used linear interpolation to use an alpha value of 0.5 to blend the image overlapped areas, reducing the presence of the edge overlap for the images.