I want to find the most used colour in an image using python. for example detect the colour of the object in the following image
http://www.shopcrazy.com.ph/wp-content/images/2007/02/shiny-bags-01.jpg.
how to detect the base colour from the RGB codes(example – red in the above image).
Since you will most likely not want a histogram of all the million colors that are possible using a 24-bit color space, I suggest transforming the image into HSV space instead.
Then you can partition the Hue part of that space into a number of bins that describe the hues you want to find (“dark red”, “orange red”, or whatever). Then make a histogram of these bins and find which is the dominant hue, which is the “color”.
The wikipedia article http://en.wikipedia.org/wiki/HSL_and_HSV should get you started. IF you are using an image processing library chances are that a rgb-to-hsv/hsl function exists.
Also, if the images are large and speed is an issue, you might consider downsampling the image to a smaller size before histogramming.