Nothing new going algorithm wise here just used the closest color then segmented histograms and then the minimum distance methods to make these. They didn’t turn out as well as I hoped but I started with some crappy source images anyways I’m looking forward to trying more. But even more excited to get some Star Trek: The Next Generation mosaics going. You can never have enough Jean Luc Picard, the man with the most peculiar french accent in existence.

See them all in their Voyager goodness
I sat down read a few papers and came up with a new way to select tiles, nothing crazy first the closest color algorithm is used to find the top find the top 1000 matches then the histograms of the source’s tile image is compared to the tile image to get a number form 0-1 indication the closeness.
The results were actually very encouraging.
Here is a quick sample at 45 tiles per image. I’ll have some lower tile count images later.
The new algorithm looks great except the colors came out a little washed out, this is most likey due to using the grayscale histogram when comparing the images. I chose to that because I was already choosing a group of tile images based off of color so the histogram comparison was mostly comparing the bright and dark spots of the images. Also if you check the new algorithm it suffers from the same effects the closest color image does. Namely the banding that occurs when like images appear next to each other, this can be easily fixed by running the minDistance algorithm on the image.
After that I want to look into other matching algorithms including comparing the images full color histogram instead of using closest color to prescreen the images then use the grayscale histogram to weed those out. Also check out using error diffusion to help select tiles (like when an image’s palette is reduced also referred to as dithering)
I bet ultimatly the best method of selecting tiles is going to be a weight combination of different methods.
Click on the thumbnails see the larger versions

New!

Closest Color

Closest Color +
Mindistance
I gave it a shot and ended up with some ok results there is still a lot that can be done to improve things.
Using just the closest color ends up with ok results but when there are large areas of an almost solid color the results are less than desirable. These can be seen in the closestColor gallery.
To further extend things I created an algorithm that tries to insure that a given image doesn’t appear more than once in a given radius. This seems to work really except when two tile images are fairly close together. These can be seen in the Closest Color + Minimum Distance 16 gallery.
check them out in the links below
Back to making this thing better.
How to find the right color
An RGB color can be thought of as a coordinate in a 3d Cartesian space. So to find the distance between two colors it is nothing more than find the distance between two coordinates in a 3d space.
(R1, G1, B1) and (r2, G2, B2)
SQRT((R1-R2)^2+(G1-G2)^2+(B1-B2)^2)
very easy now lets have MySQL do all the work and find the best match.
Imagine a table called images with columns r, g, and b where r, g, and b are the average colors of that particular image and below {R}, {G}, and {B} are the average RGB values of the source image rectangle we are comparing.
|
SELECT SQRT((images.r-{R})*(images.r-{R})+(images.g-{G})*(images.g-{G})+(images.b-{B})*(images.b-{B})) as score, images.id as id, images.location as location FROM images ORDER BY score ASC LIMIT 150; |
This will return a nice little list of the 150 closest matches by color. 150 were returned so at a later step in the mosaic creation process we can do a little more processing to the mosaic matching results.
Gratuitous amounts of Imagery
I need images and I mean lots of images. In my head I can only see having more images to make up the tiles the better. Of course every time I add an image it makes searching for the correct image a little slowewr, but ups the chance I may find a better match.
(more…)
Why a Photo Mosaic?
Seems like there have been more and more photo mosaics popping up on digg lately. I figured I could make one, but one up the other people and actually write the program to make them instead of using some program I found online.
(more…)