Programming Project #4A: Image Warping and Mosaics!

Niraek Jain-Sharma

Part 1: Shoot the Pictures

In this part of the project, I shot several pictures around my neighborhood (northside), and some in my apartment. Below are some of the pictures I took!

House 1/2

Ladder 1/2

Leaves 1/2

Part 2: Recover Homographies

The goal of this project was to recover the homographies from one image into the coordinate system of another. First, I used Gimp to hover over similar points in both images, wrote them down, and exported them to a csv and read them in using pandas. See below for an example of the correspondence points for one pair of images:



Now, let's describe how to solve for the homography matrix. Because we have more than 4 points in the labeling as shown above, we use least squares to solve for A, namely Min(||Ax-b||^2). We apply the following and get the homography matrices.



Part 3: Warp the Image

In this part, we use the homography matrix we calculated in the previous part, and warp our image onto the correspondence points of our second image. This will allow us to blend/merge the images once they have the same coordinate system. See below for an example of a warped image:

Image Original/warped

Part 4: Image Rectification

We can utilize the work done above to rectify images! The idea is that if there is a slanted image that takes pictures of things that are in reality specific shapes (e.g. taking a picture of tiles on the floor at an angle, but in reality are squares), then we can actually warp these image using correspondence points to their wanted shape. In the following cases, I chose correspondence points of the corners of the rectangles - both turned out nicely!

Elephant Slanted/Rectified

Table Slanted/Rectified

Part 5: Blend into a mosaic

This is the culmination of our previous efforts! Here we will be blending two images together by utilizing the warp function described above, and then overlapping the images with blending to make a bigger mosaic. First, we will show the naive method of blending, which is just adding them on top of each other.

House 1/2


Ladder 1/2


Leaves 1/2

As we can see above, the mosaics look pretty good, but with the naive blending, they have clear overlap lines. However, this is useful for us to see where the overlap actually lies!

Finally, see below for the blended versions of the mosaics. I set an alpha channel, and put 1 in the center, and did a linspace downward from there radiating to the edges of the picture. As you can see, it does pretty well, the lines are gone!

House Blended
Ladder Blended
Leaves Blended