Mosaic Project Progress
Between last friday and today I have made a fair amount of progress on my mosaic project. The basic modules are all implemented and I have done a fair bit of refinment already. As I suspected, efficiency (in calculations and in the program's memory foot print) is the big determining factor in how good of a mosaic it can produce.
Original "seed" image of a car ~~~>
If you check out my web photo album, I have added a new public folder with some mosaics I have made after a fair bit of tweaking and modifications. The album contains scaled down versions of the original images (the seed images), scaled down versions of the mosaics the program produced, and some zoomed in cropped images so that the individual tiles can be seen.
<~~ Mosaic of the above image, click to see larger version
Currently, the program has a library of aprox 250 images of varying color, size, and origin (some are mine, some are stolen from stock photo sites on the internet. larger librarys help a ton!). The mosaics you can see in the album have a set number of tiles in the direction of the seed image's longer side (125 currently) and a proportional number in the other direction to keep the photo's original aspect ratio. Each tile produced in the end image is 50x50 pixels which means the final mosaics are 6250x___ pixels large. Yeah thats pretty big. The app currently saves the images into PNG format which has decent compression but I haven't tweaked the default settings, so currently some of the mosaic files are quite large (ranging from 4MB - 30MB). PNG format was chosen b/c its a loss-less compression and I didn't want to lose any information b/c of JPEG compression (such as can been seen in the ones I uploaded. Along with losing resolution in the resize, since Picasa requires JPEGs, they also lost some clarity there). Suprisingly, each mosaic is produced in under a minute depending on the number of unique library images used and the final size.
C along with 2 main objects: an urrently, I have 4 modules: library, planBuilder, matchEngine, and mosaicBuilderImage, and a Plan. The current modules were all designed to be as simple as possible and yet functional. The matchEngine and mosaicBuilder modules have had some tweeking so that I could use 125x__ tiles without crashing the Java jeap ;). The matchEngine is currently just finding the avg color of the entire image and then doing a simple diff. against the tile its checking to see which library image is the "best". While this is working OK, I have several ideas for better matchers which could be a bit more efficient and take into account better algorithms for matching edges and colored regions. Trying to implement those algorithms is next on my list along with rewriting the mosaicBuilder to better use the file buffers and JAI tiles. If I can get those to work the work should be much faster, produce better matches, and be able to build the resulting mosaic without requiring the whole thing to be in memory at once (the big Java heap problem ... an uncompressed 6000x6000 pixel image is fairly large in memory as a BufferedImage :) ).
Thats it for now. I will post another update and some more photos when I have implemented some of those algorithms, or rewritten the mosaicBuilder. If I could at least reduce the memory footprint, I could increase the tile resolution which would help the mosaics, but not as much as better library choices. (Although all of this should run great even if inefficient on the new Mac ;) )
** one other thing I need to do is get some prints made to determine how small an image can be printed (and in what resolution/dpi/ppi) so that it can be recognized as being a photo, but as small as possible so as to fit in the mosaic better. Maybe this week I will throw together some sample images and have them printed out at Kroger. 30 cents isn't bad for a print test. :)




1 comment:
Wow! I'm impressed. You got this working in extremely short order. How much of this did you code? I'm curious about the source code if you wouldn't mind letting me take a peek.
Post a Comment