CS194-26 Project 4 Part 1 - Image Warping and Mosaicing

The goal of this project is to create tools to combine multiple photographs taken from different perspectives into a single seamless image.

The main images for testing and demonstration in this images were these two images of the Channing-Bowditch Apartments:

To transform the images as if they were taken from the same perspective, we have to be able to calculate a homography from one set of points to another set of corresponding points. To test this we can first try using a homography to rectify the image on the right.

We define a set of points, in red, on the original image, and specify a set of blue points that we want the red points to go to. The 3x3 homography matrix, which defines a transformation from the blue points to the red points is then calculated. Using the homography matrix, we can then use an inverse warping and bilinear interpolation to produce our rectified image:

We can repeat this rectification on other images:

Original
Rectified result

Next we can define a set of points on both of our images of the building:

View 1
View 2

Once again, we can calculate a 3x3 homography matrix that transforms the points from the right image to the points on the left, then use this matrix to warp the image on the left to the perspective of the image on the right. As a sanity check, we transform the points from the right onto the image on the left, and see they are more or less in the same positions:

Red points are the originally labeled points in View 2, Blue points are the points transformed from View 2 to View 1

We then use an inverse warping to transform the image on the left:

A naive overlaying of the two images, creates a clear line:

To make the combination look nicer, we can blend the two together using alpha blending, creating a softer and less noticeable seam:

We can apply this to other images too:

View 1
View 2
Result
View 1
View 2
Result