image006
IMAGE WARPING and MOSAICING

First Part of Stitching Photo Mosaics
CS194-26 Image Manipulation and Computational Photography

Background
Part 1: Shoot the Pictures
Part 2: Recover Homographies
Part 3: Warp the Images
Part 4: Image Rectification
Part 5: Blend the images into a mosaic
Part 6: Tell us what you've learned
Bells and Whistles: TBA
Mesut Xiaocheng Yang
Electrical Engineering and Computer Sciences - Computer Science Division
Undergraduate Student
xiaocheng.yang@berkeley.edu

Background:

This project is aimed to help us understand the basics of image warping and mosaicing.


Part 1: Shoot the Pictures

I chose to take a few pictures in VLSB libraries. This particular sequence has a few outstanding advantages: there are a lot of rectangular objects which could be used to align, and the color difference is obvious enough to tell the quality of the alignment.

q1.JPG

q2.JPG

q3.JPG


Part 2: Recover Homographies

In this part, I used the method outlined in this post, which is basically computing the w for each individual point, and scaling the previous two equations. Therefore, there are two equations for each pair of points. For this part, I picked 9 coorepondences between q1.jpg and q2.jpg, and 10 coorespondences between q2.jpg and q3.jpg. Then I use least square solver to find the optimal a-h parameter, to reconstruct the H matrix.

q1 points - 1_2

q2 points - 1_2

q1 points - 3_2

q2 points - 3_2


Part 3: Warp the Images

I apply the forward Homography to the four corners to get the a sence of the location that the source image will be mapped to the destination image. Then I expend/shrink the window of the destination image to make sure the transformed source image fit snug. I record the offset I used, to help the mosaicing process in the subsequent section. I spent a lot of time on this part, mainly because Matlab uses relatively inconsistent indexing conventions that I was not fully aware of.

q1.jpg

q1.jpg wrapped to q2.jpg

q3.jpg

q1.jpg wrapped to q2.jpg


Part 4: Image Rectification

In this part, I selected a area of vent hole in q3.jpg as area of reference. The 9x9 vent hole area is supposed to be square. I map it to a 200x200 pixel square.

vent hole area

rectified q3, with respect to 9x9 vent hole


Part 5: Blend the images into a mosaic

I recycled the offset I recorded in the warping section of the project to decide the offset I shift every individual image, as well as how big the output image is supposed to be. Then I tried two method of mosaicing: direct copy, and alpha blending. Here are the two results.

Mosaic without blending

Mosaic with alpha blending, alpha = 0.5


Part 6: Tell us what you've learned

Matlab is tricky. X and Y coordinate can cause many troubles if one is not careful. In addition, selecting points that spread across the image will result in better homography. Last but not least, keeping track of extra information about offset when shifting is the way to go.