开发者

Max color used in a RGB image

开发者 https://www.devze.com 2023-02-13 17:36 出处:网络
I have some RGB images. What\'s the best way to know most color used in an image is Red or Yellow or White?

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

精彩评论

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