目录
一、roipoly
roipoly(img)可以提取掩码区域,创建掩码图像。
二、代码
clear
jpg = imread('C:\\Program Files\\MATLAB\\R2017a\\toolbox\\images\\imdata\\baby.jpg');
roi = im2uint8(roipoly(jpg));
roi_cmp = bitcmp(roi);
interest = bitand(jpg,roi);
non_interest = bitand(roi_cmp,imdivide(jpg,1.5));
combine = bitor(interest,non_interest);
subplot(2,2,1),imshow(jpg),title('initial')
subplot(2,2,2),imshow(interest),title('interest')
subplot(2,2,3),imshow(non_interest),title('non_interest')
subplot(2,2,4),imshow(combine),title('combine')
三、效果