Panoramas Part 1

George Geng

In this project I explore the powerful properites of homographic transformations, which can be used to create neat effects such as panoramic images.

Computing the Homography

Homographic Transformation

 
Given a set of at least 4 input points, and a target set of corresponding points, we can find the homography H. We begin with the following equation:
$\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} = \begin{bmatrix} wx' \\ wy' \\ w \end{bmatrix}$

 
With a little bit of linear algebra, we can find the following equation to solve for the elements of H:
$\begin{bmatrix} x & y & 1 & 0 & 0 & 0 & -xx' & -yx' \\ 0 & 0 & 0& x& y & 1 & -xy'& -yy' \end{bmatrix} \begin{bmatrix} a \\ b \\ c\\ d\\ e\\ f\\ g\\ h \end{bmatrix} = \begin{bmatrix} x' \\ y' \end{bmatrix}$

 
When we use more than 4 points, we use least squares approximation. In general, the more points the better for aligning images.

Image Rectification

Once I found the homography, we can rectify images if we specify points we would like to transform and the final points of the transformation. Here I test it on a rectangle that doesn't look so rectangulary at first.

Rect

Rectified Rect

 
I tried it also on one of my favorite illustrated books, based on one of my favorite short animated films, The Dam Keeper .


Panorama

Now, I can stitch together photos into a panoramic mosaic. First, I warp one image to another's perspective plane. Here are some pictures of Berkeley's mural.



 

 
Although the images are aligned in the correct perspective, there are a lot of artifacts in the overlap region. I resolve this by blending images with a linear alpha blend.
Mural Panorama

 
Here, are some lovely pictures of the Elmwood District, where you'll find Ici's icecream parlor and a bird store! I did not expect the panorama to turn out this successfully, due to the incoming sunglight from the left and the drastically different lighting conditions of the original image. However, linear alpha blending seemed to take care of this very nicely.


Elmwood Original
Elmwood Cropped

 
I added a third image to the panorama on the right. However, you see more distortion on the left because the left two images are shifted into the perspective plane of the third addition.

 
Elmwood Distortion

 
A remedy I have not explored yet would be to warp the rightmost image towards the center in this case, instead of warping images from the left to the right.

Final Thoughts

Overall, this project was exciting and helped me learn a lot about homographic transformation. It was especially nice to go out exploring the outskirts of Berkeley. I really enjoyed the first part of this project, and how some simple linear algebra can completely change the perspective of an image. I'm excited for what's to come.