what is the ideal solution to find a color in an image?

1 次查看(过去 30 天)
Hi, what is the ideal solution to find a color in an image? knowing that I have used these lines with matlab but I didn't come to make clear the correct RGB values of colors. Every time I find a value for example light brown I found that: R = 173, G = 129, B = 80 and on other sites I found that: R = 181, G = 101, B = 29
idx = I(:,:,1) == ?? & I(:,:,2) == ?? & I(:,:,3) == ??;
C = any( idx(:) );
thanks

回答(2 个)

Image Analyst
Image Analyst 2012-10-15
Guess what? They're both light brown. Did you think that light brown was only 1 of the 16 million possible colors, and not, say tens of thousands of possible values? Actually colors are a continuum and where in color space you say one color stops and the other takes over is a matter of opinion - a judgment call. What you call a color can span a range of RGB values - it's not just one single value.
You might want to look over my color segmentation tutorials: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  37 个评论
Pamela Paolo
Pamela Paolo 2012-11-3
移动:DGM 2023-12-30
To find a specific color (blue-grey) in an image we can't use:
idx = I(:,:,1) == ?? & I(:,:,2) == ?? & I(:,:,3) == ??;
C = any( idx(:) );
Because every color has many R, G and B values. So how i can find this color without using a uniform image?
Image Analyst
Image Analyst 2012-11-4
移动:DGM 2023-12-30
Right. And I know you've seen my color classification tutorials in my File Exchange, so......why can't you use one of them? What colors you get around blue-gray depends on what method you use. The delta E mathod carves out a sphere out of the gamut in LAB space, while the HSV method carves out a sector in HSV space. So, while similar, they may get different colors out near the extremes of the range you're extracting.

请先登录,再进行评论。


Pamela Paolo
Pamela Paolo 2012-11-5
The delta E method allows the user to pick a color as an example from the image and then it will find all the other pixels with similar color to that in the image while this isn't the case in my project. The code should allow to find a specific color from the beginning (blue-grey) without user intervention. As you said, to adapt this code to our situation, we can use it to find the mean LAB or HSV color of blue-grey. How? What is the image used to find this mean Lab or HSV color of blue-grey?
This code <https://www.mathworks.com/matlabcentral/fileexchange/28512-simple-color-detection-by-hue/content/SimpleColorDetectionByHue.m> detect yellow regions using a given low and high thresholds. In my case i don't have the low and high thresholds of blue-grey. How can I do this?
  6 个评论
Image Analyst
Image Analyst 2012-11-6
移动:DGM 2023-12-30
I do understand your question. I know you don't know the values - yet - that's why I said " just look at the h, s, and v values at some particular pixel location that has a blue-gray pixel to discover what the h, s, and v values actually are". Then you know what the values are, then you hard code it into your program. Why will that not work?
Image Analyst
Image Analyst 2012-11-15
移动:DGM 2023-12-30
Pick your color values from one of these web sites:
http://ivrg.epfl.ch/files/content/sites/ivrg/files/research/alindner/CIC2012/www/ColorThesaurus.html Type blue-grey (using the UK spelling of gray) into the search field. You can type any color in any language in and get the color. Or, pick a color from a color picker and find out the names in 9 or 10 different languages for that color.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by