Project 4A - Image Warping and Mosaicing

Eric Tang

Shoot the Pictures (and define keypoints)

For this step I shot pictures of some murals and streets around Berkeley, and defined 10 corresponding points between pairs of images of the same scene from a different perspective.

image
Mural Center
image
Mural Right
image
Keypoints
image
Keypoints
image
Channing Left
image
Channing Right
image
Keypoints
image
Keypoints
image
Blake Left
image
Blake Right
image
Keypoints
image
Keypoints

Recover Homographies

For recovering homographies, we defined the keypoints as shown above. We then used overparameterized least squares in order to try and accurately estimate the homography between the two images that we loaded in the previous section.

This yielded a 3x3 matrix defining a transformation from a set of points in one image to a set of points in another, which we could use to perform the warping for rectifying images and constructing mosaics.

Warp the Images (and Rectify some)

In order to warp the images, we used the homography matrix H we calculated to transform the set of points in a given image into a set of points from which to sample from the image. I used the cv2.remap function in order to sample the transformed points from the original image (I also experimented with using RectBivariateSpline, and had reasonable results, but ran into issues on the borders of images).

image
Mural Warped
image
Mural Warped
image
Channing Warped
image
Channing Warped
image
Blake Warped
image
Blake Warped

Rectified Images

Something else interesting that can be done is rectifying an image to show a planar surface in a frontal-parallel fashion. This was done to validate the warping, with keypoints for the plane corresponding the the four corners of the original image for calculating the homography.

image
Rasputin Music
image
Rasputin Music Rectified
image
CREAM
image
Koja Kitchen?

Blend images into a Mosaic

Finally, we blended warped images together into a mosaic, combining them using weighted averaging. I computed a mask of the overlapping region between two images in the mosaic, and set the mask value to be 0.5 in the overlapping region in order to try and best blend the two images together. The value in the mask would have to be updated for any additional image that also overlapped in the same region.

image
Mural Center
image
Mural Right
image
Mask
image
Mosaic
image
Channing Left
image
Channing Right
image
Mask
image
Mosaic
image
Blake Left
image
Blake Right
image
Mask
image
Mosaic

What did I learn

I learned how we can warp and rectify images to change perspective easily, as well as how to stitch together images by computing homographies, which is pretty cool.