Color finding on RGB image
Show older comments
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?
26 Comments
Walter Roberson
on 25 Jun 2018
Please define "highlighting color" ?
sam CP
on 25 Jun 2018
Walter Roberson
on 25 Jun 2018
No, I do not know what dominant color is, and I do not think you know what dominant color is either. In one of your previous Questions I posted links to previous discussions explaining why none of us know what "dominant color" means, what some of the complications are.
sam CP
on 25 Jun 2018
Ngonidzashe Nedziwe
on 25 Jun 2018
im not sure if this is what you are trying to do. have you tried getting the mean of the RGB image. and then extracting the individual mean of the RGB vector?
sam CP
on 25 Jun 2018
Ngonidzashe Nedziwe
on 25 Jun 2018
Edited: Walter Roberson
on 25 Jun 2018
have you looked at these links? https://www.mathworks.com/matlabcentral/answers/231214-how-to-find-the-contrast-of-a-image-in-matlab
sam CP
on 25 Jun 2018
Ngonidzashe Nedziwe
on 25 Jun 2018
by using the given code in that article, u can be able to find the contrast between the highest valued pixel and the lowest valued. taking it to rgb image, u can define ranges for a specific rgb color. from there u can then check the size of the regions to find the color which has the greatest pixel contrast. the values of the colors can be found if you do a google search on rgb color chart.
Walter Roberson
on 25 Jun 2018
"Here the dominant color is that which color have high sharpen and contrast."
In your earlier demo image, you are pushing for yellow to be called the dominant color of the image, but yellow does not have high sharpness or contrast in that image.
sam CP
on 25 Jun 2018
Walter Roberson
on 25 Jun 2018
So if you have a solid medium green image, but it has a single bright red pixel in it, then that is a sharp boundary between the single red pixels and the background, and it is high contrast because the red and green channels vary quite a bit compared to the background. That implies that the single red pixel is the "dominant color" by that definition.
sam CP
on 25 Jun 2018
Stephen23
on 25 Jun 2018
Walter Roberson's test image. What is the dominant color?:

sam CP
on 25 Jun 2018
Walter Roberson
on 25 Jun 2018
In your demo.img with the yellow waterfall, the black is sharp boundaries and high contrast to the yellow and green, and is the only color that has more than 5% of the pixels; so is it correct that the dominant color for that image is [0 0 0] ?
In the case of your demo6 image with the lanterns, no color is more than 0.52%, so is it correct that that image has no dominant color?
sam CP
on 25 Jun 2018
Stephen23
on 25 Jun 2018
And for this? (5% + 1 pixel):

Why is green NOT dominant?
Walter Roberson
on 25 Jun 2018
I went through every Question that mentioned dominant color or primary color (including the ones where that it was an accidental combination of words.) In the entire time that MATLAB Answers has existed, not one person has known what "dominant color" is.
sam CP
on 25 Jun 2018
Stephen23
on 25 Jun 2018
@sam CP: no, because I don't understand why green is not dominant in my second example image.
@sam CP: In this and other threads of you several people try to explain repeatedly, that there is not definition of "dominant color". Does this information reach you?
Even asking again and again will not change this answer.
"High contrast and sharpness" is not a unique definition also. I asked you already what the "dominant color" of the French flag is and I'm sure that this is an example of an image, which cannot have one dominant color.
So it is your turn to provide a unique definition, such that the forum can suggest an implementation. But without such a definition from you, this question has no relation to Matlab and would be off-topic.
OCDER
on 25 Jun 2018
One cannot program a search for "dominant" or "recessive" color because this is a human perception, unique to each person. A computer does not have human perception (yet). There is also the color blindness issue.
Walter Roberson
on 25 Jun 2018
Hmmm, that link at least gives more information to go with, but I can't say I am inspired with any ideas as to how one might program the concept.
Walter Roberson
on 28 Jun 2018
(This discussion carries on from https://www.mathworks.com/matlabcentral/answers/407086-can-i-use-color-map-to-find-which-color-is-the-most-used-color-in-an-image)
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!