代码实现的最终效果
clc
close all;
I=imread('E:\matlab\toolbox\images\imdemos\html\cirlce.bmp');
figure(1);imshow(I);
se=strel('ball',20,5);
I1=imclose(I,se);
figure(2),imshow(I1);
se1=strel('ball',35,5);
I2=imopen(I1,se1);
figure(3),imshow(I2);
I3=im2bw(I2,0.6);
figure(4),imshow(I3);
I4=I3;
I5=I;
[m,n]=size(I4);
for i=1:m-1
for j=1:n-1;
if(I4(i,j)==1&I4(i,j+1)==0)
I5(i,j,1)=255;
I5(i,j,2)=125;
I5(i,j,3)=122;
end
end;
end
figure(5),imshow(I5);