CS 194-26 ~ Project #6A ~ Image Warping and Mosaicing

Matthew Sie : cs194-26-aep

Step 1: Shoot and Digitize Pictures

I obtained four different sets of pictures taken panorama style (one set from online, three taken with camera) and three images for the "rectified image" section (two from online, one taken with camera).

Step 2: Recover Homographies

Using the equation p'=Hp, and two input sets of corresponding points, we are able to find the homography matrix, H, using linear algebra. Since the homography matrix, H, has 8 unknowns, we need at least 4 pairs of corresponding points in order to solve the equation. Furthermore, if we have more than 4 pairs of corresponding points, we must use least squares in order to solve the equation.

Step 3: Warp the Images / Image Rectification

The warping function, which takes in an image and a homography matrix, first calculates the dimensions of the warped image by multiplying the homography matrix, H, by each of the corners of the original image and creates an empty image with the correct dimensions. Then, each pixel within this empyt image finds is proper warped pixel by applying the inverse of the homography matrix to find the proper point from the original image. Below are three examples of image rectification completed using this warping function.

Step 4: Blend images into a Mosaic

To produce a mosaic, we imported the two images to be stitched together, defined correspondence points, computed the homography, and warped one image to another. This gives us one warped image and another image that is still in its original state. The next step is blending. First, using one of the corresponding points we defined earlier, we calculate the necessary shift and shift the images to their appropriate positions so that they are overlayed with each other properly. Next, in order to minimize human error from manual selection of correspondence points, we run an SSD scoring function over a 200x200 pixel region around the correspondence point being used. And finally, using this optimal overlay positioning of both images, we perform a linear blending between the two images in their proper position to obtain the final mosaic. Below are four examples of mosaics constructed using this method, including a vertical panorama.

Better mosaics were produced when more correspondence points were used and when more time was spent to diligently and accurately select correspondence points. Additionally, I noticed that images with trees produced some blurry results probably due to movement of the plants while taking the photos.