views:

689

answers:

3

At some long-ago Flash conferences I recall seeing a demo of a Flash app that had a color picker. Based on the user's color choice the app would show the user a set of images within the approximate range of that color: a bunch of mostly red images, a bunch of mostly blue images, etc.

I'm looking for two things: 1) A link to a demo of this sort of app, ideally a Flash app 2) ActionScript or C# code that describes how to pick a bunch of images that fall within a color range.

I know how to extract the aggregate/average RGB from individual images and persist this info to a database. I need to know how exactly to select out images within a certain range of color tolerance. Could this be done purely using SQL and a knowledge of the alphanumeric assignments of RGB color codes, or is there a better way?

+1  A: 

I could not find any sample code, but found an article that gives a high-level explanation of their process (from this other page about Flickr's feature to search for images with similar colors). Apparently, Google also lets you do this with their image search (but I don't know if that is from metadata tags or actual color matching).

Now to the actual answer:

Instead of just storing the average or aggregate color for an image, you will need to store a "color signature" of the image.

My first (educated guess) idea would entail these steps:

  1. Generate the histogram for each color band from the image
  2. Generate some factors that describe each histogram curve (mean, variance, std-dev, etc? -- these factors will make up your digital signature of your image)
  3. Store those factors in your database (and each of these factors would have an index in the DB)

Then, you would take your input (either a color, range of colors, or source image), run your histogram algorithm against that source, and search for matches to your computed factors.

Erich Mirabal
Thanks, Erich, this got me started. The book Flickr Hacks has some code that will be helpful, it's Hack #45. Book is here: http://www.amazon.com/Flickr-Hacks-Sharing-Photos-Online/dp/0596102453
kendor
You can preview the book on Google Books (beta). http://books.google.com/books?id=WLx95OWUMYkC and then click on "Preview Book" and go to page 280 for Hack #45 as you suggest.
Erich Mirabal
+1  A: 

The Flickr Hacks solution I cite in the comments is the best I've found: it involves resizing the image to 1x1 pixels using common algorithms which gives you an average color for the entire image. Clever.

kendor
A: 

You can use a set of descriptors for each image, then match those.

There's some great work here on it.. for C#.

http://savvash.blogspot.com/p/compact-composite-descriptors.html

Also check out the free img(Rummager) tool.. which can do what you want(ie find images matched by colour).

timemirror