Project 5

Shoot and Digitize Pictures

Here, I shot photos in multiple perspectives, but remaining in the same position while just turning the camera to face different directions. I also ensured that there were some linear objects in order to make choosing points easier, as well as ensuring that the photos overlapped quite a bit.

Recover Homographies

In this section, I recovered the parameters of the transformation between each pair of images. In our case, the transformation is a homography: p’=Hp, where H is a 3x3 matrix with 8 degrees of freedom (lower right corner is a scaling factor and is set to 1). I used least squares to recover the homographies.

Rectified Images Through Warp

Using the inverse of the homography matrix I calculated, I created a warp function to warp the points into the same perspective so it can be later blended. Here, I used cv2.remap to remap the images to new warped locations. For the mosaic specifically, I remapped the side images to match the center one and also allowed for excess height and width to account for the fact that the warping may cause the dimensions to change (height * 1.5, width * 3).


As an example, I took pictures of tilted and objects at different perspectives and passed in straight points into my warp function in order to rectify the images below. (The examples aren't perfect since the points I passed in aren't exact in dimension)

Blend Images into Mosaic

Finally, I used an alpha value of 0.5 to blend the warped images together and create a final mosaic.

House Original and Warped

House Mosaic

Yard Original and Warped

Yard Mosaic

Living Room Original and Warped

Living Room Mosaic

Coolest Thing I Learned

I think the coolest thing I learned was that computing a homography allows you to map the points in one image to the corresponding points in the other image. In this way, we can take pictures at different perspectives, but then warp them into the same perspective using the homography matrix.