Image Mosaic

Image mosaicking is a process in which a larger image is formed from small pieces of smaller images. In this short fun project, I have tried to implement a simple algorithm to do this task. This algorithm is based on block by block histogram matching.

You can download my Matlab implementation and test files [ZIP].

“If an image is worth a thousand words, an image mosaic is worth a million”

Result of Mosaic
Result of Mosaic

A basic approach for mosaicking was followed. The process was to divide the target image into blocks of size of the inset image. For example, assume the target image is 3000×2000 and inset image to be 20×20. So, this 3000×2000 image was thought of as multiple blocks of 20×20.

Histogram was computed for these 20×20 blocks. The resulting histogram was matched with the inset image. What we also mean is, the inset image was modified such that, histograms of it and the particular block becomes equal. Such a process is called “Histogram Matching”. This is the basis for mosaics. The corresponding blocks in target image is replaced by these histogram  matched images.

That is it….!

Analysis for Time Complexity :
The task of image mosaic is very expensive on computational power. It generally takes about 160 sec for matlab implementation with color target image of 3000×2000 and inset image of 20×20. The high requirement is due to much effort required for histogram matching for each blocks.

Assume that, the size of target image is MxN and that of inset image is mxn. Let Tmxn be the average time required for one histogram matching operation.

Time Complexity for Mosaic
Time Complexity

Possible Future Work: 

  • Implementation of algorithm in faster language like C/C++.
  • Use of multiple inset images.
  • Implementation with inset video and target video.
  • Proposition of better algorithms.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s