1. Define Correspondences
To start the project, I took pictures of random things with my IPhone. I then defined correspondences between the images with
ginpoint in python.
2. Recover Homography
Before I can align the pairs of images, I need to recover the homography transformation matrix H. As seen in the equation below, H is a 3x3 matrix. If we set scale factor i to 1, then we have 8 unknown variables to solve. Thus, we need a minimum of 4 pairs of corresponding points to either directly solve for H or estimate H using least squares.
3. Image Warping
After recovering the homography matrix, I then use inverse warp to creat the transformed image: I first applied the homography transformation on the corner points of the original image to find the border offsets, then created a blank output image with appropriate padding, before finding the inverse warped pixel for every point in the output image.
To test my homography recovering and image warping process, I rectified a few simple images so that square shapes in the images are frontal-parallel.
1. Apartment Building
2. Apartment Building
3. Toy Collection
It's really cool that I'm able to create my own panoramas in this project! The image warping process was more challenging than I had expected because of padding issues, but I'm glad to finally get it to work as desired.