%先用canny,然后进行孔洞操作,再进行膨胀操作
%对简单的图片效果好
I = imread('picture00.jpg');
I=imresize(I,[600,600]);
I=rgb2gray(I);
BW = edge(I,'canny') ;
IBW=BW;
F1 = imfill(IBW,'holes');SE = ones(3);F2 = imdilate(F1,SE,'same');BW3 = bwperim(F2);
BW4=imfill(BW3,'holes');
figure,imshow(I);
figure,imshow(BW3);
figure,imshow(BW4);
%先进行孔洞操作,再进行膨胀操作
%对复杂的图片效果好,而且要调试IBW=BW;或者IBW=~BW;看哪个更适合
I = imread('picture16.jpg');
BW=im2bw(I,0.4);
IBW=~BW;
F1 = imfill(IBW,'holes');SE = ones(3);F2 = imdilate(F1,SE,'same');BW3 =