close all;
clear all;clc;
f=imread('F:\ZuoYe\maoci.bmp');
Image2=im2bw(f,49/255);figure,imshow(Image2);%二值化
g1=bwmorph(Image2,'thin',2);figure,imshow(g1);
g2=bwmorph(g1,'thin',Inf);figure,imshow(g2);%细化图像,Inf设置参数n为无穷大,可以指示函数重复操作直到图像停止改变
se=strel('rectangle',[11 11]);%设定结构元素为一个半径为1的圆盘
g3=imdilate(g2,se);figure,imshow(g3);
% g3=bwmorph(Image2,'skel',Inf);figure,imshow(g3);%骨骼化figure,imshow(g2);图像 骨架提取但保持图像中物体不发生断裂
% g4=bwmorph(g3,'spur',5);%去毛刺像素
% figure,imshow(g4)
subplot(221),imshow(f);
subplot(222),imshow(g1);
subplot(223),imshow(g2);
subplot(223),imshow(g3);
% subplot(224),imshow(g3);
% se=strel('rectangle',[11 11]);figure,imshow(se);%设定结构元素为一个半径为1的圆盘