Following the formula in the lecture slide, I created a "computeHomography" function that takes in 2 sets of coordinates, and returns a matrix H that when multiplied by coordinates, warps them into the specified shape.
Using code that was similar to project 3 (face warping), I took the points within the polygon of the object I wanted to straighten out (in this case, a Stevie Wonders album), and multiplied them by the H matrix. I used normalized, and used these points to index into the original image, with new output coordinates. Here are my results.
Warp the images so they're registered and create an image mosaic. Instead of having one picture overwrite the other, which would lead to strong edge artifacts, use weighted averaging.
I learned about the homography matrix and how it can be used to rectify an image. I did not know about these calculations beforehand, and it was interesting to see how simple it was. However, I would like to try it again with a more streamlined process using cv2 functions that we were not allowed to use.
Points generated by the Harris Interest Point Detector
Points generated by Adaptive Non-Maximal Suppression
Points generated by Feature Matching
Points generated by RANSAC