CS 194-26 Proj 6A
Preetham Gujjula (cs194-26-adt)
Overview
In this project, we simulate panorama style images by taking multiple images from the same vantage point and different angles. We warp the images to the same perspective using homographies and stitch them together to form our panoramic image.
Shooting and Digitizing
I took a few sets of photographs.
Rectification 1: A painting
Rectification 2: My laptop on a bed
Mosaic 1: The view outside my room
View 1 | View 2 |
Mosaic 2: A dirty kitchen
View 1 | View 2 | View 3 |
Mosaic 3: A foreboding pantry
View 1 | View 2 | View 3 |
Recover Homographies
For the images I rectified, I recorded the points around the subject, and associated them with 4 points in a rectangle to create a set of 4 correspondences. For the mosaic images, I created about 10 - 12 pairs of correspondences between the images. For the mosaics with 3 images, I corresponded the left and right images each to the center image. I did not find that I needed to manually correct the correspondences I defined.
To compute the homography, I set up two equations for each pair of correspondence points, as described in https://math.stackexchange.com/a/1289595. Unlike the MathOverflow post, I set h9 = 1, so I only had to solve for 8 variables.
Of course, using 10 - 12 pairs of correspondences overdetermined my system, so I used np.linalg.lstsq to find a best-fit solution.
Warp Image
After computing the homography H from points1 to points2 (for example), I applied H on the corners of the image I wanted to warp to find the bounds of the warped image. Then I interpolated the image and used the inverse of H and the interpolation to compute the appropriate value for every pixel inside the warped image.
Image Rectification
Applying this technique to the images I wanted to rectify yielded the following results:
Rectification 1: A painting
Rectification 2: My laptop on a bed
Blending Images:
I applied the warping technique to each image set, and then appropriately padded the resulting images to obtain 2 or 3 sets of warped images I could stack on top of each other to form the final image. To combine the images, I used np.maximum to take the maximum value at each pixel. The result images have very few artifacts.
Mosaic 1: The view outside my room
Mosaic 2: A dirty kitchen
Mosaic 3: A foreboding pantry
What I’ve Learned
I learned that creating a panorama only requires a little linear algebra to do properly. The concepts behind this project were not very difficult. The most difficult parts of the assignment were figuring out how to interpolate and apply the homography to the images properly, followed by figuring out how to stitch the images together.