In this project we will compute homographies between images in order to perform perspective warps in order to align images in a fashion that would allow the creation of panoramas. Similar to the affine transformations we used in a previous project to do face morphs, perspective transformations will be defined by pointwise correspondances in each image matching certain features. However, the perspective transform is in 8 degrees of freedom rather than 6, so we will be able to create a more powerful warp to accomplish various things.

The computations for this project are relatively simple. We just need to define pointwise correspondances between two images and then compute a homography, a transformation matrix that will take the input points and produce the output points. Because we will use 6 or even 8 points sometimes, we have an overdetermined linear system, which we must solve by least squares regression to get the closest approximation.

Rectifying Images

Here are the results of rectifying a couple of images I just took around LA.

sign sign
Rectifying a sign
sign sign
Rectifying a building. This consequently made the buildings look a lot taller and the palm trees look warped. However, the perspective was still preserved for the most part.

Stitching a Scene

Here are the results of stitching together several pictures in a scene. We apply the same process as used in the rectification iteratively to each subsequent image. I noticed that because I was doing the images in order, the amount of warp compounded for each subsequent image due to the perspective differences and linear projection. This could have been alleviated by beginning with the central image and warping everything onto the central image instead.

varsity
My apartment
abalone
Abalone Cove in LA
sfo
SFO

Conclusion

This was an interesting exploration of perspective transforms and homographies. What I learned was that the best results were produced when the corresponding points defined a much larger, non-oblique shape, since the sensitivity to human error would be much less. Given more time I would definitely look into blending the images a lot more evenly, applying something like a multiresolution blend between two images with an alpha mask or something like that.