区域形态学

1. 膨胀,腐蚀

区域R,结构元S。对区域R的膨胀定义为:结构元S平移到t点(也就是结构元参考点平移到t点),并且平移后结构元St和R有交集。所有这样的t点集合构成了对区域R的膨胀。

区域R,结构元S。对区域R的腐蚀定义为:结构元S平移到t点(也就是结构元参考点平移到t点),并且平移后结构元St完全在R内。所有这样的t点集合构成了对区域R的腐蚀。

引用官网的话:

To dilate or erode an input region, a structuring element is applied to the input region. This structuring element is scanned over the image line-by-line. During dilation the reference point of the structuring element is added to the resulting region whenever the structuring element and the input region have at least one pixel in common. This results in an enlarged region, as shown in the image below. Erosion reduces the area of the input region because the reference point is only added to the resulting region if the structuring element lies completely within the input region. As a result, erosion can alternatively be used to find objects.

2. 击中、击不中变换

膨胀、腐蚀的结构元只有一个,而击中、击不中有两个结构元:前景结构元Sf和背景结构元Sb。

击中击不中定义为:结构元(Sf, Sb)平移到t点(也就是结构元参考点平移到t点),并且平移后前景结构元Sf彻底落在前景内,而背景结构元Sb彻底落在背景内。所有这样的t点集合构成了击中击不中变换集

3.开操作、闭操作

平移后的结构元S完全在区域R内,满足这样条件的所有平移后结构元集合St的并集就叫开操作。

膨胀、腐蚀、击中、击不中都是平移后结构元参考点t集合。而开操作与结构元参考点无关,它可以保持要搜索的物体的形状。利用这个特性,可以用来做定位。

根据对偶原则:

对前景的一个闭操作等同于对背景的一个开操作。反之亦然。

对前景的一个膨胀处理等同于对背景的一个腐蚀处理。反之亦然。

开操作/闭操作是幂等的,多次使用开操作/闭操作的结果与一次开操作/闭操作的结果相同。这点与膨胀/腐蚀不同。

4. 顶帽、底帽

顶帽:输入区域 - 开操作

底帽:闭操作 - 输入区域

5.算子

区域形态学算子结构元结构元参考点
dilation1erosion1arbitraryorigin
dilation2erosion2arbitraryarbitrary
dilation_circleerosion_circlecircularorigin
dilation_rectangle1erosion_rectangle1rectangularorigin
openingclosingarbitraryorigin
opening_circleclosing_circlecircularorigin
opening_rectangle1closing_rectangle1rectangularorigin

 

 

 

 

 

 

 

 

 

  • dilation1(Region, StructElement : RegionDilation : Iterations : )
  • erosion1(Region, StructElement : RegionErosion : Iterations : )

 

  • dilation2(Region, StructElement : RegionDilation : Row, Column, Iterations : )
  • erosion2(Region, StructElement : RegionErosion : Row, Column, Iterations : )

Row :Row coordinate of the reference point.
Column:Column coordinate of the reference point.
Iterations :Number of iterations.

  • dilation_circle(Region : RegionDilation : Radius : )
  • erosion_circle(Region : RegionErosion : Radius : )

Radius:Radius of the circular structuring element.

  • dilation_rectangle1(Region : RegionDilation : Width, Height : )
  • erosion_rectangle1(Region : RegionErosion : Width, Height : )

Width :Width of the structuring rectangle.
Height:Height of the structuring rectangle.

  • opening(Region, StructElement : RegionOpening : : )
  • closing(Region, StructElement : RegionClosing : : )

 

  • opening_circle(Region : RegionOpening : Radius : )
  • closing_circle(Region : RegionClosing : Radius : )

Radius:Radius of the circular structuring element.

  • opening_rectangle1(Region : RegionOpening : Width, Height : )
  • closing_rectangle1(Region : RegionClosing : Width, Height : )

Width :Width of the structuring rectangle.
Height:Height of the structuring rectangle.

  • hit_or_miss(Region, StructElement1, StructElement2 : RegionHitMiss : Row, Column : )

hit_or_miss performs the hit-or-miss-transformation. First, an erosion with the structuring element StructElement1 is done on the input region Region. Then an erosion with the structuring element StructElement2 is performed on the complement of the input region. The intersection of the two resulting regions is the result RegionHitMiss of hit_or_miss.

The hit-or-miss-transformation selects precisely the points for which the conditions given by the structuring elements StructElement1 and StructElement2 are fulfilled. StructElement1 determines the condition for the foreground pixels, while StructElement2 determines the condition for the background pixels. In order to obtain sensible results, StructElement1 and StructElement2 must fit like key and lock. In any case, StructElement1 and StructElement2 must be disjunct. Row and Column determine the reference point of the structuring elements.

  • top_hat(Region, StructElement : RegionTopHat : : )

top_hat computes the opening of Region with StructElement. The difference between the original region and the result of the opening is called the top hat. In contrast to opening, which splits regions under certain circumstances, top_hat computes the regions removed by such a splitting.

The position of StructElement is meaningless, since an opening operation is invariant with respect to the choice of the reference point.

  • bottom_hat(Region, StructElement : RegionBottomHat : : )

bottom_hat computes the closing of Region with StructElement. The difference between the result of the closing and the original region is called the bottom hat. In contrast to closing, which merges regions under certain circumstances, bottom_hat computes the regions generated by such a merge.

The position of StructElement is meaningless, since a closing operation is invariant with respect to the choice of the reference point.

6. 例子:利用开操作做定位

dev_close_window ()
read_image (letters, 'letters')
get_image_size (letters, Width, Height)
dev_open_window (0, 0, Width / 2, Height / 2, 'black', WindowID)
dev_display (letters)
threshold (letters, Region, 0, 100)
connection (Region, ConnectedRegions)
select_obj (ConnectedRegions, ObjectSelected, 100)
* Erosion of a region with a circular structuring element
erosion_circle (ObjectSelected, RegionErosion, 1.5)
opening (Region, RegionErosion, RegionOpening)
dev_display (letters)
dev_set_color ('red')
dev_display (RegionOpening)

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值