Assign black pixels to binary image
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Abdul Salam
am 28 Jun. 2019
Kommentiert: Abdul Salam
am 29 Jun. 2019
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?

0 Kommentare
Akzeptierte Antwort
Image Analyst
am 29 Jun. 2019
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));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!