Assign black pixels to binary image

1 回表示 (過去 30 日間)
Abdul Salam
Abdul Salam 2019 年 6 月 28 日
コメント済み: Abdul Salam 2019 年 6 月 29 日
I have a binary image and i want to assign black pixels to the white segment and then mask it on original image. How can i do that?binary.JPG

採用された回答

Image Analyst
Image Analyst 2019 年 6 月 29 日
If "mask" is your binary image, and you want the white parts to be black (and the original pixels in the black areas of your binary image left unaltered) in your original grayscale or rgb image , called "yourImage", do this:
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
maskedImage = bsxfun(@times, yourImage, cast(~mask, 'like', yourImage));
  1 件のコメント
Abdul Salam
Abdul Salam 2019 年 6 月 29 日
Thanks a lot. It realy worked for me. :)

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

その他の回答 (0 件)

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by