[学习笔记]形态学图像处理-膨胀与腐蚀

膨胀是在二值图像中“加长“或”变粗“的操作。

A = imread('Fig0907(a)(text_gaps_1_and_2_pixels).tif');
B = [1 1 1;1 1 1;1 1 1];
imshow(A)
A2 = imdilate(A, B);
figure
imshow(A2);

处理前的图像:

膨胀后二值化图片:

strel函数用于构造各种结构元素:

se = strel(shape, parameters)

例如:

SE = strel('ball', R, H, N)
SE = strel('diamond', R)
SE = strel('disk', R, N)
SE = strel('line', LEN, DEG)
SE = strel('octagon', R)
SE = strel('pair', OFFSET)
SE = strel('periodicline', P, V)
SE = strel('rectangle', MN)
SE = strel('square', W)
 
getseqsuence(se)用于分解结构元素。
 

 腐蚀是”收缩“或”细化“二值化图像的过程。

A = imread('Fig0905(a)(wirebond-mask).tif');
se = strel('disk', 10)
imshow(A)
A2 = imerode(A, se);
figure
imshow(A2);

腐蚀前:

腐蚀后:

膨胀与腐蚀的结合:

1、开运算: 

2、闭运算

例子:

f = imread('Fig0911(a)(noisy_fingerprint).tif')
figure()
imshow(f)
se = strel('square',3)
fo = imopen(f,se)
figure()
imshow(fo)
foc = imclose(fo, se)
figure()
imshow(foc)

处理前:

开运算后:

对开运算结果执行闭运算:

posted on 2013-09-16 22:25  寻梅踏雪  阅读(1079)  评论(0编辑  收藏  举报

导航