Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting Dominant / Most Used Colors from an Image

I would like to extract the most used colors inside an image, or at least the primary tones Could you recommend me how can I start with this task? or point me to a similar code? I have being looking for it but no success.

like image 930
biquillo Avatar asked Nov 24 '09 04:11

biquillo


2 Answers

You can get very good results using an Octree Color Quantization algorithm. Other quantization algorithms can be found on Wikipedia.

like image 163
Mark Ransom Avatar answered Oct 28 '22 02:10

Mark Ransom


I agree with the comments - a programming solution would definitely need more information. But till then, assuming you'll obtain the RGB values of each pixel in your image, you should consider the HSV colorspace where the Hue can be said to represent the "tone" of each pixel. You can then use a histogram to identify the most used tones in your image.

like image 24
Jacob Avatar answered Oct 28 '22 03:10

Jacob