CS194-26 Project 5: Homography and image stitching

Kevin Shi

Overview

In this project, I will write stitching algorithms for panoramas from scratch.

Part 1: Manual Point Choosing

We must first start with an image to stitch. In this first part I will stitch images by manually choosing points, calculating the Homography, and finally warping and stitching.

Here are the images and the points I chose. You can see that I chose corners because they are the easiest to match accurately.

Part 1.1: Homography

We will calculate a Homography matrix to warp the images. In theory, since Homography maticies only have 8 unknowns, so we only need 4 points. However, it is better to leave room for error, so as you can see in the images above, we choose more points. This leads to a overdetermined equation that I use least squares to solve. Hopefully the error in manual choosing of points can be modelled by a gaussian, in which case the gaussian noise will converge to the optimal solution with least squares.

We first use this homography transform to get a "bird's eye" view of the room. Let's see whats in the box.

Part 1.2: Warp and stitch

Now let's use the points and warp our image to match.

Now if we just naively stitch them together by lying the images ontop of each other, we get a rough panorama:

However, that seam is quite ugly, lets fix it by using a weighted average based on distance from the seam.

That looks much better! Now we have a panorama algorithm given two images and corresponding points.