Project 4: Image Mosaicing

Jordan Kaye, 11/26/10

Main idea:

The goal of this assignment was to write an algorithm to take a set of related input images and automatically find the overlap between them in order to create a mosaic-type output. As we learned in class, a mosaic is built by finding the overlap between peripheral images and a central image, then using the overlap to find a homography for each peripheral image. This homography can then be used to transform the peripheral images so that they can be combined to form a mosaic.

Algorithm:

The overlap between two images can be found using a RANSAC algorithm. Once the overlap has been found, we can use the best four points to find a homography between each peripheral image and the central image. We can use this homography on each corner point of the peripheral images to determine the dimensions of the final mosaic. After all of this information is obtained, one can create a blank image that will eventually be the mosaic output. By sending this blank image through the inverse homographies of each peripheral image and using interpolation to extract the pixels from the source images, we can easily obtain the associated pixels needed from each input image. Creating the final mosaic is accomplished by sequentially applying inverse masks in order to make sure that each pixel in the mosaic comes from only one input image (since the images overlap, without masking many pixels would come from multiple sources).

Psuedocode:

For each input image:
Use RANSAC to find the best overlap points
Use the points to compute a homography
Apply the homography to corner points and compare to current dimensions, update final dimensions if necessary
Create a blank mosaic of the final dimensions
Send the blank mosaic through the inverse of each homography, interpolate pixels from source images
Create a bitmask from the central image
As each group of pixels is applied to the final mosaic, update the bitmask

Results:

The results of the algorithm were fairly good. The RANSAC does not always choose a perfect overlap, but for the most part the images look okay. One of the provided example image sets:

RANSAC points:

Remapped source images:

Result:

My own image set:

Input images:

 

RANSAC points:

Remapped images:

 

 

Result:

Limitations:
As we can see above, the biggest limitation of the algorithm is lighting. When a picture is taken at a different angle from the original, the lighting often changes, creating variations that are clearly noticable in the final mosaic.

Source code:

mosaic.m
findH.m
applyH.m