Fun with Image Warping and Mosaicing!

Xingyu Jin < xingyu.jin21@berkeley.edu >

Background

This project will explore different aspects of image warping and its application in image mosaicing.

Shoot and Digitize picture

In this part, I took photos of my living room with a digital camera, where I stand in the center of the room and took picture with different view direction. I shoot pictures from the same position by turning camera instead of translating it. My original pictures are shown as follows:

Recover Homographies

In this part, I constructed a matrix from two n-by-2 matrices holding the (x,y) locations of n point correspondences from the two images in order to solve the linear system to get the recovered 3*3 homography matrix. Here, I used the least square algorithm to solve for the homography matrix.

When selecting the keypoints, I used the second picture as my target picture and used the computeH fuction to get the homography matrix for transforming the other two pictures into the second one. I chose the second picture because it is the "front view" of my room, which is ideal for serving as a reference. When selecting the key points, I used ginput function to select the square blocks in the images so that they can correspond to each other.

Warp and "Rectify" the Images

In this part, I wrapped the first and third picture using the homography matrix H calculated and get the following results.

As we can see, even though the transforming leaves many pixels as "black", it still correctly straightened the two blocks in the image to correspond to the reference image (second image). This is a successful image rectification.

Blend the image into a mosaic

In order to bind the images into a mosaic, I used weighted averaging. To do so, I decide to use what I did in the previous part that I left the second image unwarped and warpped the other two images into its project. When deciding the final size, since all my original pictures are of the same size, I choose to keep the original picture's height and increase the width by 0.3 (so that I can bind the other two images into one).

Thereafter, they are of the same shape and I can direclty stack them and get the final mosaic image.