How to overlay a binary mask over an rgb image?
조회 수: 5 (최근 30일)
이전 댓글 표시
I am trying to overlay a binary mask over an RGB color image. I want to change the white area of the mask to a transparent red area and put it over an rgb image.
For example:
image:
mask:


I want something similar to this:

I alredy tried this method but I couldn't figure it out. What is a simple way (no matter how slow) to do this?
채택된 답변
Meg Noah
2020년 1월 9일
Here's some code:
img = imread('diplo000000-L.png');
mask = imread('sdfsd.png');
mask(:,:,1) = 0;
img(mask>0) = 0;
image(img)
set(gca,'ydir','reverse');
imwrite(img,'newimage.png');

댓글 수: 2
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!