CS-194-26 Project 4 Part A

Zachary Lieberman

PART 1

Shoot and digitize pictures

I took two pictures of the inside of Haas library using the same center of projection and rotating my camera. Both images feature square paintings so I used the corners of the paintings in common as correspondences. I also took two pictures of a computer at an angle and then rectified them.

First picture of Haas library wall

Second picture of Haas library wall

First picture of computer at an angle

Second picture of computer at an angle

PART 2

Recover Homographies

To calculate the homography matrix I used the formula found on Piazza at this link, https://towardsdatascience.com/estimating-a-homography-matrix-522c70ec4b2c. I then inputted my correspondences, created the A matrix based on the formula, created the b matrix out of the destination correspondence points, and then used least squares to find the homography matrix. This gave me 8 numbers, so I appended a 1 to the end.

PART 3

Rectification

To rectify the image, I first established the points of correspondence around the computer and the computer's keyboard. I then created a rectangle of similar aspect ration in a blank image space. Using the correspondence from computer to rectangle, I calculated H, warped the corners of the computer image to this new space, and then inverse warped this new space back to the original computer image and interpolated. This left me with a rectified image.

Rectified version of first computer image

Rectified version of second computer image

Part 4

Warp the images

Using a warp formula found on Piazza and opencv.remap(), I was able to warp my images. I tried to use the same code as I had made for rectify but ran into many problems and hours of debugging did not work. I settled for this solution instead.

Warped version of the second image of Haas on to the first image's plane

Padded version of the first image of Haas that is aligned with the warped image

Part 5

Mosaic Stitching

For this section, I tried using my project 2 blending code but it would not run for some reason. I tried a lot of techniques to blend but could not figure anything out. So, I just added the two and there is a noticeable seam.

Combined image of the original image of Haas and the warped portion to the right of the original image

What have I learned?

I learned the process of rectifying and now better understand the concept of forward warping to produce the image boundary and then inverse warping to interpolate. The coolest thing I have learned is the actual demonstration of homographies in action and how the viewing angle of an image can be changed by a matrix. This was a crazy realization and not one I had ever considered to be true before.