实验四 形态学图像处理(二) (2).pdf
实验四形态学图像处理(二)(2)--第1页
实验4形态学图像处理(二)
实验目的:
1.了解形态学的基本理论和方法;
2.掌握对图像进行膨胀/腐蚀的方法;
3.掌握开闭运算;
实验内容:
1.采用bwmorph函数(P268)对图片mask.tif进行细化操作,
了解bwmorph的其他功能。
答:
f=imread(mask.tif);
g=bwmorph(f,thin,Inf);
subplot(1,2,1),imshow(f),subplot(1,2,2),imshow(g);
实验四形态学图像处理(二)(2)--第1页
实验四形态学图像处理(二)(2)--第2页
2.对图片cktboard.tif进行形态学平滑操作。参考P279
答:
f=imread(cktboard.tif);
f=medfilt2(f);
g1=imopen(f,se);
g2=imclose(g1,se);
subplot(2,2,1),imshow(f),subplot(2,2,2),imshow(g1),subplot(2,2,3),imsho
w(g2);
实验四形态学图像处理(二)(2)--第2页
实验四形态学图像处理(二)(2)--第3页
3.对图片0252.bmp进行T。参考P280
答:
g=imread(0252.bmp);
se=strel(disk,20);
go=imopen(g,se);
g2=imsubtract(g,go);
subplot(1,2,1),imshow(g),subplot(1,2,2),imshow(g2);
实验四形态学图像处理(二)(2)--第3页
实验四形态学图像处理(二)(2)--第4页
4.对图像lung.bmp进行二值化(im2bw函数)后,对其中的肺
部图像进行孔洞填充,结果参照图1。参考P275
实验四形态学图像处理(二)(2)--第4页
实验四形态学图像处理(二)(2)--第5页
孔洞填充后
图1孔洞填充效果
答:
k=imread(lung.bmp);
k1=imadjust(k,[0,1],[1,0]);
k2=im2bw(k1,0.82);
k3=imfill(k2,holes);
subplot(2,2,1),imshow(k),subplot(2,2,2),imshow(k1),subplot(2,2,3),imsh
ow(k2),subplot(2,2,4),imshow(k3);
实验四形态学图像处理(二)(2)--第5页
实验四形态学图像处理(二)(2)--第6页
5.(提高题)在上题基础上,进一步分离出肺部图像,结果如
图2所示。
分割出的肺图
实验四形态学图像处理(二)(2)--第6页
实验四形态学图像处理(二)(2)--第7页