CS 194-26 - Project 6: Stitching Photo Mosaics

Eli Lipsitz (cs194-26-acw)

Note: Click on any image to enlarge it.

Photos and Correspondences

I took a series of photographs of different subjects, where I kept my camera in the same location but rotated it after each picture to capture a wider field of view.

I created a small wrapper around ginput to allow the user to input correspondences between images, and proceded to use the tool to find correspondences between each successive pair of photographs in each set.

Correspondence Input Tool

Image Rectification

I also took a few individual images that had rectangular objects or planes in them, to use to test my homography finding code and image warping code.

I used a similar ginput based tool to define four corners of a rectangle within each image, and then compute the homography to fix the angles of the quadrilateral to 90 degrees each:

Foothill
Sign on Telegraph Ave

I rectified the front face of Foothill on the left, and the "Hydrant" sign on the right. I recommend clicking on each image to view it in full size:

Foothill
Sign on Telegraph Ave

Panoramas

Using the correspondences defined previously, and the function to compute the homography matrix and transform an image, I created three panoramas of three photographs each, where the left and right image were both warped to the projection of the center image.

Lake in Wisconsin

RSF Fieldhouse

Living Room

Blending

To actually blend the three separate transformed images, I first took the binary masks of each of the transformed images:

Then I computed for each white pixel the distance from the nearest black pixel, to get a smooth fade in each of the masks:

And then I summed each of the masks and normalized them against the sum, to get a mask which could be multiplied component-wise each each of the respective transformed source images before summing them together.

There are some weird wedge artifacts in the distance fields due to the sharp shape of the masks, but it still ends up blending well.

Learning

Before this project, I didn't realize just how distorted the edge of the field of view gets with perspective. It makes sense that fisheye lenses have such severe distortion due to needing to squeeze a large amount of image into a small area (the edges of the frame).

I was also trying to stitch together more than 3 images -- but the transformation that would be applied to another image in the sequence was just so severely stretched (probably due to reaching approximately a 180 degree field of view) that it didn't work -- the final image would have ended up being millions of pixels across.

I also tried to stitch together some pictures I took a year or two ago at a train station, but the correspondences never ended up actually lining up -- it seems that I must have moved too much while taking the pictures.