Halcon膨胀腐蚀

简介:

               膨胀可以增大区域,填充内部孔和增强了离散点,但增大了面积。腐蚀可以缩小区域,减少间隔区域的连接和离散点的数量,但减小了面积。 开运算是先腐蚀后膨胀,有益于消除线和点区域,减少干扰。闭运算是先膨胀后腐蚀,有益于连接间隙和孔,使区域更加连贯。

 

介绍:

  1. 膨胀: dilation_rectangle1, dilation1, dilation2, dilation_circle, dilation_golay, dilation_seq.
  2. 腐蚀: erosion_rectangle1, erosion1, erosion2, erosion_circle, erosion_golay, erosion_seq.
  3. 开运算:opening_rectangle1, opening, opening_circle, opening_golay, opening_seq,gray_opening, gray_opening_rect, gray_opening_shape.
  4. 闭运算:closing_rectangle1, closing, closing_circle, closing_golay, gray_closing, gray_closing_rect, gtay_closing_shape.
dilation_rectangle1(用矩形结构元素膨胀区域)
Region (input_object) Regions to be dilated.区域
RegionDilation (output_object)  Dilated regions.输出的膨胀区域
Width (input_control)Width of the structuring rectangle.
Default value: 11
Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201
Typical range of values: 1 ≤ Width ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 10
Height (input_control) Height of the structuring rectangle.
Default value: 11
Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201
Typical range of values: 1 ≤ Height ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 10
erosion_rectangle1(用矩形结构元素腐蚀区域)
Region (input_object) Regions to be eroded.区域
RegionErosion (output_object) Eroded regions.输出的腐蚀区域
Width (input_control) Width of the structuring rectangle.
Default value: 11
Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201
Typical range of values: 1 ≤ Width ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1
  Height (input_control)Height of the structuring rectangle.
Default value: 11
Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201
Typical range of values: 1 ≤ Height ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1
opening_rectangle1 (用矩形结构元素进行开运算)
Region (input_object)  Regions to be opened.区域
RegionOpening (output_object)Opened regions.输出的开运算区域
Width (input_control)  Width of the structuring rectangle.
Default value: 10
Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200
Typical range of values: 1 ≤ Width ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1
Height (input_control) Height of the structuring rectangle.
Default value: 10
Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200
Typical range of values: 1 ≤ Height ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1
closing_rectangle1(用矩形结构元素进行闭运算)
Region (input_object)  Regions to be closed.区域
RegionClosing (output_object)  Closed regions.输出的闭运算区域
Width (input_control) Width of the structuring rectangle.
Default value: 10
Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200
Typical range of values: 1 ≤ Width ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1
Height (input_control) Height of the structuring rectangle.
Default value: 10
Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200
Typical range of values: 1 ≤ Height ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1

 

使用:

  1. 通过动态阈值或全局阈值提取目标区域。
read_image (Image, 'E:/照片/RGB')

decompose3 (Image, Image1, Image2, Image3)
trans_from_rgb (Image1, Image2, Image3, ImageResult1, ImageResult2, ImageResult3, 'hsv')
 
auto_threshold (ImageResult3, Regions, 2)
connection (Regions, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions, 'area', 'and', 200, 50000)

*threshold (ImageResult3, SelectedRegions, 128, 255)

*膨胀
dilation_rectangle1 (SelectedRegions, RegionDilation, 11, 11)
*腐蚀
erosion_rectangle1 (SelectedRegions, RegionErosion, 11, 11)
*开运算,先腐蚀后膨胀
opening_rectangle1 (SelectedRegions, RegionOpening, 11, 11)
*闭运算,先膨胀后腐蚀
closing_rectangle1 (SelectedRegions, RegionClosing, 11, 11)

 

RGB
分割的区域
膨胀

 

腐蚀

 

开运算

 

闭运算

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值