views:

80

answers:

2

I've read a number of questions on finding the colour palette of an image, but my problem is slightly different. I'm looking for images made up of pure colours: pictures of the open sky, colourful photo backgrounds, red brick walls etc.

So far I've used the App Engine Image.histogram() function to produce a histogram, filter out values below a certain occurrence threshold, and average the remaining ones down. That still seems to leave in a lot of extraneous photographs where there are blobs of pure colour in a mixed bag of other photos.

Any ideas much appreciated!

+1  A: 

How about doing this?

  1. Blur the image using some fast blurring algorithm. (Search for stack blur or box blur)
  2. Compute standard deviation of the pixels in RGB domain, once for each color.
  3. Discard the image if the standard deviation is beyond a certain threshold.
Pankaj
You can even try without blurring, just a standard deviation.
Pankaj
I'm working on fairly small thumbnails of images, so I think I could forego blurring indeed. Thanks for the suggestion!
mitjak
This could work if you are looking for uniform colors, one case where this would fall would be looking at a brick wall half of which is red and half of which is yellow bricks. I believe OP is looking for high saturation.
Unreason
Above it should say single color not uniform color
Unreason
A: 

In my opinion a histogram will not be the ideal tool for the this task since it typically looks at separately at each color channel and you will loose information like this. So for example if you get peaks at 255 red, green and blue this can either mean that there is lots of red (0xFF0000), green (0x00FF00) and blue ( 0x0000FF) in the image or that the whole image is simply entirely white ( 0xFFFFFF).

I recommend you to use a color quantization algorithm on your image: http://en.wikipedia.org/wiki/Color_quantization and have it return you the 16 most dominant colors. Then maybe convert them to HSL and check for values with a high saturation.

Quasimondo
I think high saturation is what is sought here (wall with red bricks). And I think that saturation histogram would work very well here without any quantization.
Unreason
Yes, you are right - if it is about saturation only and you do not care about particular hues a saturation histogram will work just fine (and be faster to calculate than a quantization)
Quasimondo