Project 5A: IMAGE WARPING and MOSAICING

Violet Yao (cs194-26-afs)

Recover Homographies

Before we could warp images into alignment, we need to recover the need to recover the parameters of the transformation between each pair of images. In our case, the transformation is a homography: p’=Hp, where H is a 3x3 matrix with 8 degrees of freedom (lower right corner is a scaling factor and can be set to 1). To recover the homography, I collected a set of (p’,p) pairs of corresponding points taken from the two images using ginputs.

\[H = computeH(im1\_pts,im2\_pts)\]

In order to compute the entries in the matrix H, we need to set up a linear system of n equations (i.e. a matrix equation of the form Ah=b where h is a vector holding the 8 unknown entries of H). The system can thus be solved via four or more corresponding pairs.

Warp the Images

Now that we know the parameters of the homography, we can go ahead to warp images using this homography.

\[imwarped = warpImage(im,H)\]

where im is the input image to be warped and H is the homography.

Image Rectification

Below are the examples for image rectification! The LHS ones are original images of planar surface and the RHS are those warped to frontal-parallel.

Example1: Granola Box

Example2: Rousseau's Reveries

Blend the images into a mosaic

In this part, I warp two images taken at the Grand Canyon so they're registered and create an image mosaic. Instead of having one picture overwrite the other, which would lead to strong edge artifacts, I used linear blending to make it more seamless.

Tell us what you've learned

The result comes out from last part is super cool! I didn't expect it to blend so well. I have never been good at photoshop so glad to learn that I could do the same thing with code!