CS194-26 Project 5 Part A:

I first began the project by taking multiple images of my phone at different angles. We will call the left image IMAGE_1 and the right image IMAGE_2

Recover Homographies

In order to recover the matrix, I first calculated the homography matrix H using the equation Ap'=p, where p is the chosen coordinates on the image that other images are being warped into. I then use np.linalg.lstsq() to calculate p' and construct the homeography matrix from that.

Warp the Images

compute target shape of the warped image using H and forward homography
generate a list of all target warping points
inverse warp target pts to im pts
filter all out-of-bound points in all the im points
interpolate to find pixel values of in_im pts
fill in target from the interpolation values
To warp an image, we first need to use the homeography matrix to compute the shape of the warped image and generate a list of the warping points. We then need to adjust some of the points as some of them will be out of bounds of the new warped image. Finally, we interpolate the points to find the pixel values and use those values to fill in the target image.

original image

target image

warp image

Image Rectification

warp result