open连通黑色的小区域
close连通白色的小区域
tophat(src-open)用于黑底亮图案,产生黑底亮图案,增强了未连通的小区域,imtophat
增强采用 tophat -srcImg,产生了黑底亮图案
bottomhat(close-src)适用于白底黑图案,参数黑底亮图案,增强了未连通的小区域
srcimg-bottomhat产生白底黑图案,
close all; clear all; clc;
I = imread('test.bmp');
se = strel('disk', 3);
er = imerode(I, se); % 腐蚀
di = imdilate(er, se); % 膨胀
figure(4)
imshow(er);
figure(5)
imshow(di);
%J = imtophat(I, se);
K = imbothat(I, se);
L = imsubtract(I,K);%imsubtract( imadd(I, J), K ); % I+J-K