- black often occupies a large total fraction of the area (even if only in ones and twos in the background.)
- black is pure primary color
- isolated black pixels surrounded by non-black pixels have a high contrast
Color finding on RGB image
11 views (last 30 days)
I have an RGB image ,i have to find the dominant color from this image. Dominant color means the highlighting color. (That will be red,blue,green, yellow etc.). What all are the steps that can be implemented in this process?
Walter Roberson on 27 Jun 2018
I took the actionable ideas from the paper that OCDER linked to, and developed some code.
The paper talked in terms of purity of primary color, and it talked in terms of contrast, and it talked in terms of portion of the image occupied. So my code calculates though three factors, normalizes them each to 1, and then comes up with an aggregate statistic by taking the geometric mean (geometric mean is less likely to favor a location that ranks high in only one of the three.)
What I found is that if the image has black, then the measure is likely to pick out the black as being the most dominant. This is because:
So when the three measures are used together, it is not uncommon for black to be declared most dominant.
data.jpg and data6.jpg both have black pixels selected as most dominant. The standard demo image "peppers" picks out a yellow pixel though.