For this project, we calculated homographies after defining correspondences between two photographs with projective (perspective) transformations, meaning the camera didn't translate between taking the photos. Using the computed homographies, we can then "rectify" an image and create image mosaics.
In order to warp our images, we need to recover the homography matrix that provides the transformation between the pair of images. I constructed a matrix of the following form, where (xi,yi) and (xi',yi') are pairs of corresponding points of the two images. We then solve for the 8 unknowns and append a 1 to the end since the lower right corner is the scaling factor. This gives us the 3x3 homography matrix, which we use in the following sections.
Now that we have the homography matrix, we can warp one image to the perspective of another. My warp function is modified
from the warp function I implemented in Project 4 where I again used inverse warping.
First, I started small to ensure that I have computed the correct homography matrix and implemented the right warp function. I tested photos where the objects were taken at a perspective, and then applied my warp function so that the plane is now frontal-planar (the image is flattened as if staring straight-on).
Here I warped the left image to the perspective of the right image, aligned the warped left image result with the right image, and then blended them together using a weighted average.
As you can see, there is quite some ghosting in the Freeway Park panorama due to great amount of high frequencies.
I learned a lot through this project, which has taught me so much about homographies and altering perspectives. It was also great to use what I have learned and coded in previous projects and apply them here. The coolest part for me was that I was able to take photos I've taken months or even years ago and either warp the image so that the object is now frontal-planar or take two photos and create a panorama after-the-fact.