matlab 图像处理 函数

  • 格式:doc
  • 大小:29.00 KB
  • 文档页数:2

Select.m
matlab函数bwareaopen──删除小面积对象
格式:
BW2 = bwareaopen(BW,P,conn)
作用:
删除二值图像BW中面积小于P的对象,默认情况下conn使用8邻域。

算法:
(1)Determine the connected components.
L = bwlabeln(BW, conn);
(2)Compute the area of each component.
S = regionprops(L, 'Area');
(3)Remove small objects.
bw2 = ismember(L, find([S.Area] >= P));
Matlab中函数strel在操作结构元素应用
Matlab中函数strel在操作结构元素应用,用于膨胀腐蚀及开闭运算等操作的结构元素对象
具体用法:SE = strel(shape,parameters)
创建由指定形状shape对应的结构元素。

其中shape的种类有
arbitrary'
'pair'
'diamond'
'periodicline'
'disk'
'rectangle'
'line'
'square'
'octagon
参数parameters一般控制SE的大小。

例子:
se1 = strel('square',6)% 创建6*6的正方形
se2 = strel('line',10,45)% 创建直线长度10,角度45
se3 = strel('disk',15)% 创建圆盘半径15
se4 = strel('ball',15,5)% 创建椭圆体,半径15,高度5
Matlab中用imdilate函数实现膨胀
用法为:
Imdilate(X,SE).其中X是待处理的图像,SE是结构元素对象。

例如:
bw = imread('text.tif');
se = strel('line',11,90);
bw2 = imdilate(bw,se);
imshow(bw), title('Original')
figure, imshow(bw2), title('Dilated'
Matlab用imerode函数实现图像腐蚀
用法为:
Imerode(X,SE).其中X是待处理的图像,SE是结构元素对象。

例如:
I = imread('cameraman.tif');
se = strel('ball',5,5);
I2 = imerode(I,se);
imshow(I), title('Original')
figure, imshow(I2), title('Eroded')。