binary mask of RGB image

5 ビュー (過去 30 日間)
Lamya Mohammad
Lamya Mohammad 2019 年 10 月 23 日
コメント済み: Image Analyst 2022 年 7 月 20 日
Hello everyone,
I'm new to matlab
I'm wondering if is there is a function that can help me in performing the followings:
I have an RGB image, I'm gonna spicify a range of values for every RGB component.
so I have three ranges of values.
then, the values in the image that in these ranges, I want them to be white
values outside the range will be black.
How can I write a code perform this?
Thank you

採用された回答

Image Analyst
Image Analyst 2019 年 10 月 24 日
Try this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
redMask = redChannel >= redMin & redChannel <= redMax;
greenMask = greenChannel >= greenMin & greenChannel <= greenMax;
blueMask = blueChannel >= blueMin & blueChannel <= blueMax;
finalMask = redMask | greenMask | blueMask;
  8 件のコメント
Imran Riaz
Imran Riaz 2022 年 7 月 20 日
Can you recommend any other way to remove the background automatically, bcz I have more that 4500 images.
Image Analyst
Image Analyst 2022 年 7 月 20 日
I'd convert to HSV and look for Saturation values below and above 0.25. Below will be white/gray, and above will be colored/skin. Use the Color Thresholder on the Apps tab.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by