Overview

This project looks at homographies and apply this concept to rectify and create panoramics of images. For this project, I took several photos of household items as well as the surrounding area around my house. The first two objects are for the rectify part, and the last three are for the mosaic part.

Computing the Homography

Before we can warp the images, we need to recover the homography matrix where we can transform between the two images. We know that we can transform between two images via $p' = Hp$ where H has 8 unknown variables. I decided to use SVD to solve for my homography matrix rather than least squares and got pretty good results. After solving for the H matrix, I used cv2.remap to map the points from the source image to the destination image.

Rectifying Images

To rectify my image, I took a picture of a slightly sideways object and a front facing object. I then computed the homography matrix using the points shown in the image before and transformed the sideways object to the front facing object. Results are shown in the third pannel

Blending Image to a Mosaic

To blend images into a mosaic, I took picture of scenes with overlapping points and calculated the H matrix on the points labeled in the image. I then padded the first image and warped the second image into the first image. I then used linear blending where in the middle, alpha=0.5, and it slowly decreases towards the end. Although there are some artifacts, the result still is compelling. The third pannel is the blended mosaic.

What I've learned

I learned a lot about how stitching images work, and it's much more complicated than I originally had thought! It is amazing that our phones can do panormaics so seamlessly even when there is significant calculations involved. The toughest part of the project was definitely learning how to calculate the homography matrix.