下面我来介绍一下关于形态学中的骨架提取,并在MATLAB中实现:
1、打开MATLAB软件,在其主界面的编辑器中写入下列程序:
I=imread('G:\MATLAB\bm.bmp'); %读取当前路径下的图片
subplot(2,2,1),imshow(I);
title('原始图像');
axis([50,250,50,200]);
axis on;
I1=im2bw(I);
subplot(2,2,2),imshow(I1);
title('二值图像');
axis([50,250,50,200]);
axis on;
I2=bwmorph(I1,'skel',1);
subplot(2,2,3),imshow(I2);
title('1次骨架提取');
axis([50,250,50,200]);
axis on;
I3=bwmorph(I1,'skel',2);
subplot(2,2,4),imshow(I3);
title('2次骨架提取');
axis([50,250,50,200]);
axis on;
2、命名保存好之后,直接点击运行按钮,结果如下所示:
至此,关于形态学骨架提取的介绍基本完毕,请大家继续关注!!