2017-03-23 82 views
-3

我需要在灰度圖像上疊加二進制蒙版(黑白圖像),其中白色斑點以黑色疊加在原始圖像上。使用二進制圖像創建蒙版-matlab

+0

當您遇到特別的困難?加載圖片?合併兩個圖像?讓我們知道您嘗試過的內容,您的預期以及卡住的位置 – Steve

+0

使用拖放工具時,圖像上傳無法正常工作。彈出框在請求離開或停留在網頁後​​出現。 –

回答

0

我不知道我明白了什麼問題。這個(未知)的問題有兩種可能的解決方案可能是:

img = im2double(imread('cameraman.tif')); 
bw = false(size(img)); 
bw(25:100,50:150) = 1; 
res1 = imoverlay(img,bw,[1 1 1]); 
res2 = img.*bw; 
figure; 
subplot(221); 
imshow(img); 
title('original'); 
subplot(222); 
imshow(bw) 
title('mask'); 
subplot(223); 
imshow(res1); 
title('res1'); 
subplot(224); 
imshow(res2) 
title('res2'); 

,輸出: enter image description here

+0

不使用Lena? :( –