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
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.
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…)