I want to find the major color (the color which appears most often) in a picture and do some analysis later.
For example, if I have this picture:
What I want to do is find out that gray, red, black, and yellow are major colors in the picture. I thought this could be done by getting a histogram with the X-axis as colors (red, blue, yellow, etc.), and the Y-axis as proportions in the image.
And once I get that histogram, I can retrieve the highest color by comparing the Y-values.
I read some examples of ImageHistogram
, ImageLevels
and some other color-related functions, but I still don't know how to do this.
Any idea is welcome.
i = 0; Image@Table[{i++/10000, 0, 0}, {h, 100}, {k, 100}]
(and why?) $\endgroup$DominantColors
function. Perhaps that is what you are going for. $\endgroup$