CS194-26 Project 4A: Image Warping and Mosaicing
Recovering Homographies
In order to recover the homography between the images, we need to manually select corresponding points between the images and create a mapping between them. For my processes I mostly used 4-8 points, but since we can select arbitrarily many (over-constrained), I used a least-squares algorithm rather than a normal linear equation to solve for the variables.
We want to solve for the following matrix H:
The system of equations we want to solve
If we use 4 sets of points, we can cancel out the Z_a variables above and will result in the following equation. We also assume h_33 to be equal to 1. I used this in my least-squares calculations.
Warping and Image Rectification
In order to test my image warping, I decided to align 2 images: one of an art piece at the SF Van Gogh Popup exhibit and the other of my phone. In this part, I kind of arbitrarily guessed the points (rectangles) that the image would warp to, so there is definitely some human error here. I tried aligning the front plane to both images- first to the sunflower, then to the moon.
The original art exhibit
Sunflower as the front-parallel plane
Moon as the front-parallel plane
I then also tested the warping on the image of my phone. I think this one was pretty successful.
Original Phone photo
Warped Phone
Blending the Images into a Mosaic
I tried creating 3 different mosaics here. My process was to take in an arbitrary number of images, and blend each new image to fit the previous one/mosaic. In the case of 2 images, I would warp the second image to the first, then pad the first image to the size of the second, then add them together with some blending.
First Mosaic: apartment courtyard
Left of the Courtyard
Right of the Courtyard
Right of the Courtyard after warping
Constructed Mosaic of the Courtyard
Second Mosaic: benches
Left of the benches
Right of the benches
Constructed Mosaic of the Benches
Third Mosaic: bathroom
Left of the bathroom
Right of the bathroom
Constructed Mosaic of the bathroom
What I Learned
I actually used to love using the warping feature on instagram because I like having my images straightened/aligned to the edges, and I was always pretty curious why they limit how much you're allowed to warp to x degrees when technically you could warp it as much as you want. After doing this project I realized that warping the image too much would be really ugly and the image dimensions would make it too hard to post lol.