2024年5月11日发(作者:)

matlab函数_连通区域

1、 matlab函数bwareaopen──删除小面积对象

格式:BW2 = bwareaopen(BW,P,conn)

作用:删除二值图像BW中面积小于P的对象,默认情况下使用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([] >= P));

2、matlab函数bwarea──计算对象面积

格式:total = bwarea(BW)

作用:估计二值图像中对象的面积。

注:该面积和二值图像中对象的像素数目不一定相等。

3、matlab函数imclearborder──边界对象抑制

格式:IM2 = imclearborder(IM,conn)

作用:抑制和图像边界相连的亮对象。若IM是二值图,imclearborder将删除和图

像边界相连的对象。默认情况conn=8。

注:For grayscale images, imclearborder tends to reduce the overall intensity

level in addition to suppressing border structures.

算法:

(1)Mask image is the input image.

(2)Marker image is zero everywhere except along the border, where it equals

the mask image.

4、matlab函数bwboundaries──获取对象轮廓

格式:B = bwboundaries(BW,conn)(基本格式)

作用:获取二值图中对象的轮廓,和OpenCV中cvFindContours函数功能类似。B