pattern of color range of different shades of a particular colors RGB values?
30 次查看(过去 30 天)
显示 更早的评论
Sir I have found the RGB value of all colors.Now I have one doubt that is there any pattern in different shades of a particular colors RGB values.I want to know the pattern that how the RGB values of different shades of a particular color are decided.I will like to explain with an example as these are different shades of blue so I want to know that how to identify these different shades of blue by a single RGB value.
Midnight Blue [25-25-112] 191970
Navy [0-0-128] 000080
Cornflower Blue [100-149-237] 6495ed
Dark Slate Blue [72-61-139] 483d8b
Now suppose I want to call blue color in my program, and I want that all different shades of blue should be included in that so how could I get all shades of a same color.
Apart from this sir do you have any idea that how many different colors and shades are there in a resistor.
0 个评论
回答(2 个)
Star Strider
2017-12-15
In the colors you quoted, the third channel (blue) has the greatest value. Perhaps choosing vectors with the maximum in the third channel will do what you want:
M = [25 25 112; 0 0 128; 100 149 237; 72 61 139];
[V,I] = max(M,[],2);
Blue = M(I == 3, :);
So any value with ‘I=3’ will be chosen as being ‘blue’. You may have to refine this, so that the third channel would not only be largest, but larger than the others by some criterion.
3 个评论
Star Strider
2017-12-15
You would have to translate them to the RGB values first. Then, devise a weighting scheme such that the blue channel predominates in those colors you want to code as ‘blue’.
Image Analyst
2017-12-16
AKSHAY, you didn't see my answer, otherwise you wouldn't have asked that. Please read it, particularly the last sentence about color segmentation.
Image Analyst
2017-12-15
This question if far more complicated than you can imagine, so we can't discuss it much here other than to barely scratch the surface.
You'll have a lot of fun with this link, that searches the web by color https://labs.tineye.com/multicolr/
and this one: https://www.npr.org/sections/thetwo-way/2010/12/10/131960390/color-picker-sorts-flickr-photos-for-fun
Also take a look at the MATLAB function colorcloud() which plots a 3-D gamut of all the colors in an image.
Finally, if you need help segmenting an image based on color(s), then see the Color Thresholder on the Apps tab of the tool ribbon, or see my File Exchange.
3 个评论
Walter Roberson
2017-12-16
No, there is no pattern.
"but say for example I want grey than I want that all different shades of grey should be included in this."
Formally speaking grey has R, G, and B components that are exactly equal to each other. However, humans call a lot of other colors "grey" as well, and there is no pattern about exactly which RGB are included in any given named color.
Even if the "grey" of a resistor were printed with exactly equal R, G, and B components, the lighting you are using is probably not exactly white, and the camera sensors are probably not exactly precise, and you will probably have some shadows as well. Furthermore, if you are using JPEG then JPEG blurs edges, distorting the color.
You can calculate the "distance" of a pixel's RGB to each of the colors you are interested in, and that way determine which named color the pixel is most like... but remember that the body of a resistor can be any of several colors, so remember that the color of a pixel might be "none of the above".
Image Analyst
2017-12-16
No, I don't think you did do everything. For gray, did you try using the Color Thresholder in the Apps tab of the tool ribbon, like I suggested? Segment the colors in HSV color space and select a saturation less than about 0.25 or so. You will see only gray-ish colors remaining, right? Please try it.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!