Project 5: [Auto]Stitching and Photo Mosaics

Jiayue Tao, CS194-26-adl



Project Overview

In part A of the project, we apply perspective transforms on images for rectification and for creating panoramas.

Part 1: Image Rectification

The first thing we need to do if to define some correspondences. For image rectification, we can find a planar shape in the original photo, and then define some points that we would like them to be transformed to. For example, in the following photo that I took at Bay Street, Emeryville, I marked the four corners of one painting and then define their correspondences into a frontal-parallel square shape. Then, we compute the homography (represented by a 3x3 matrix, 8 degrees of freedom) between the two set of points by performing least-squares on the correspondence points to find the coefficients in the homography matrix H. The formula is as follows.


Image from Google

After finding H, I used inverse warping to create the rectified images. Because the transformed images can no longer fit into the same dimensions, I created a new bounding box based on where the four corners of the original image is mapped to according to H. Here are some rectified results.


Photo of a little swan maded out of snow (yes, the beak is a piece of orange peel...)
Warped Swan

I also tried to rectify this famous painting Nighthawks by Edward Hopper. I warped the painting so that the view into the window of the bar is frontal-parallel. Interestingly, after the perspective is changed, the gloomy vibe and the portrayal of lonely urban life seems much less pronounced. Perspective really shapes the artistic mood!

Nighthawks by Edward Hopper
Warped Nighthawks
Warped and cropped Nighthawks

Finally, I rectified this photo I took at Bay Stree, Emeryville. It was a wall of paintings, and I'd argue some of them can compete with the nighthawks! I rectified this photo to force the one of the paintings (the one that has a face) into a square shape. Here are the results.

Painting Wall at Emeryville
Warped
Warped and zoomed in (great painting indeed!)