开发者

Max color used in a RGB image

I have some RGB images.

What's the best way to know most color used in an image is Red or Yellow or White? The input images 开发者_如何学编程must have more than 50% red, yellow or white pixels and it's impossible to an image have two colors in same percentage. Other colors in image may be black or blue.

Is there any function in MATLAB for this?

Note that i need a method with good performance for this!

Thanks in advance...


Convert your image to the HSV colorspace (rgb2hsv) and find appropriate thresholds for Red, Yellow and White on the Hue values. E.g.

[H S V] = rgb2hsv(I);
num_red_pixels = nnz(H>=red_min & H<=red_max);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜