Homographies
To warp images, we must first create the homography matrix, H, by recovering 8 unknown entries of the 3x3 matrix. We can find the 8 unknowns, h, by having 4 points to sample from the source image and 4 corresponding points from the warped image. These 4 sets of points are plugged into a matrix A and a set of points, b, to use least-squares to get h. Then having h, we can form H.
Homography Matrix |
Ah = b |
Warp the Images
To warp the image into a desired warp we do the following:
- Given 4 or more correspondences, calculate the homography matrix, H.
- Use the corners of the original image to create the bounding box of the warped image by passing the corners through H.
- Then use inverse warping to create the warped image
Image Rectification
All the following are pictures with planar surfaces warped so the plane is front-parallel.
Our Lady of Guadalupe |
Warped Guadalupe |
SF Japanese Tea Garden |
Warped Tea Garden |
Memorial Stadium |
California |
Blend the images into a mosaic
For the next part, I combined 2 similar images to create a mosaic panorama. We accomplished this by doing the following:
- Plot points on both images where the same objects would correspond to the same points on both images.
- calculate the homography matrix, H.
- Warp one of the images to match the projection of objects of the other images and shift both images accordingly to fit into a frame and overlap.
- Blend (I used both weights and multiresolution blending)
The following are results as I used Yosemite as a clear example of plotting points, warping and overlaying, then blending:
Yosemite points |
Lake Tahoe points |
More Lake Tahoe points |
Yosemite Left |
Yosemite Right |
Half Dome overlay |
Half Dome weights |
Half Dome multiresolution blending |
Lake Tahoe Left |
Lake Tahoe Right |
Lake Tahoe weights |
Lake Tahoe multiresolution blending |
More Lake Tahoe Left |
More Lake Tahoe Right |
More Lake Tahoe weights |
More Lake Tahoe multiresolution blending |
What I learned
In this project, I learned how panoramas are created and how simple it is, but also how important it is that the pictures have to be a little similar to each other. Yet, it's easy to recognize that so much still happens in our phones because even when my pictures have very similar lighting, they still seem to have hardlines or noticeable differences where the two pictures overlay. Along with that, with manually picking the points, it becomes likely that human error will make the pictures imperfect and not overlay as well as they could.