Creating Photo Mosaics Using Digital Image Processing

 

Jesse Gilles – gillesj@msoe.edu

Milwaukee School of Engineering

 

 

My project for CS4802 was to create a program that can produce mosaic images from an original image using a large library of small thumbnail images.  The project was implemented using a framework developed for previous lab assignments.  It was written using MFC and MS VC++ 6.0.  It supports the loading and saving of images in JPEG, BMP, PNG, and TIFF formats.  The program also has the ability to blur an image and perform several methods of edge detection, in addition to the photo mosaic creation feature.

 

 

The basics of creating a photo mosaic are very simple.  Blocks of pixels in the original image are averaged and the average for each block is matched with the average color values of the images in the image library.  The thumbnail that best fits the block of pixels being examined in the original is chosen.  This thumbnail image is then scaled down to the right size and used in the mosaic image in place of the block of pixels in the original.

 

When I implemented the mosaic creator, I used the theory described above, but I also incorporated some randomness into the process.  Instead of taking the best match for the area in the original image, I chose a random image taken from the best 0.5% of the matches.  This made the result much more visually appealing.  Examples are shown below.  The method used for comparing the original pixel averages to the thumbnail averages was the standard algebraic distance formula (3-dimensional, one for each color dimension).  The results turned out fairly good.  A good image library is essential for creating decent looking mosaics.  The library I used contained 2,033 images of CD covers and is available here for free download.

 

Results

 

Original Image

 

 

Mosaic image using “best fit” only

 

Mosaic image with randomization

 

 

To see the actual detail in the thumbnails used, download the full size images.  My report on this project can be found [removed to save space].