CS 294 026 Project 4 IMAGE WARPING and MOSAICING

Author: Tiancheng Sun

Shoot the Pictures

Since I don't have a digital camera and it is hard to maintain the same point of view on cell phone, I only shot two pictures for image rectification and two image for mosaic. The rest of the images are collected from the internet. Here are the images shot from my cell phone:

dx dy
Below are the images I collected from internet (credits to Lisa Chan):
dx dy
dx dy

Recover Homographies

Here comes the most complex part of this project. The target is reshape the original pH = p' equation into a form that the 3 by 3 matrix H becomes a 8 by 1 vector h so that we could use the least square equatoin to solve it; So first, here is the original equation:

dx
By expand it, we will got ax + by + c = wx' || dx + ey + f = wy' || gx + hy + i = w
Since all the quations shares a w, we could combine the three equations above into two equation (we can set the scale factor i as 1):
ax + by + c - gxx' - hyx' = x'
dx + ey + f - gxy' - hyy' = y'
And it could be transfer into a matrix when we have multiple points:
dx
The h11 ~ h32 in the above pic represent a ~ h accordingly
And since the equation above exist in the forme of Ah = b, we could construct A and b then let the lstsq funciton solve the correct answer for us. ## Warp the Images Here are the two example of the rectified img as required:
dx dx
rectify target is that sky blue book
dx dx
rectify target is the Children of the Sea book

Blend the images into a mosaic

Although I only demostrated two image blending here, the function itself could blend any number of imgs together, all the user need to do is take the output of previous round and treat it as a new image and select control point between it and the next image.

The first mosaic:

dx dx

dx
Didn't get enough time to finsh the second and third mosaic...

Tell us what you've learned

There are mainly two parts. First of all, I learned how to convert the pH = p' homography equation into the form that could be solved by the least square equation. I believe the method of re-organizing the structure of that linear algebra equation would be useful in the future. The second part I learned is how to develop a big function efficiently, during the implementation of warpImage() function, it come to my notice that write pseudo code first would be very helpful.