Page 1 of 1

Getting most prominent colour

Posted: 2013-02-22T13:29:30-07:00
by pratikpoddar
I have images of e-commerce products (shirts, skirt, jeans) and I want to find the colour of the product - so ignore the background, pretty face etc. Just focus on the product. How can this be done with some degree of reliability?

Re: Getting most prominent colour

Posted: 2013-02-22T14:16:26-07:00
by fmw42
What file format? What version of IM are you using and what platform?

The main idea would be to reduce colors if needed depending upon format and get the top entries from the histogram. But the background may have a larger count than the shirt color depending upon how much background.

See
http://www.imagemagick.org/Usage/files/#histogram

Re: Getting most prominent colour

Posted: 2013-02-22T14:18:01-07:00
by snibgo
You need to work out what, visually, distinguishes the product from everything else. Is it always in the centre of the image? Is it the most common colour? Is the background constant for all the images?

You also need to decide what you want reported. Is a primary colour (like red, green, blue, cyan, magenta, yellow) sufficient?