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)

 

Halcon膨胀腐蚀_第1张图片 RGB
Halcon膨胀腐蚀_第2张图片 分割的区域
Halcon膨胀腐蚀_第3张图片 膨胀

 

Halcon膨胀腐蚀_第4张图片 腐蚀

 

Halcon膨胀腐蚀_第5张图片 开运算

 

Halcon膨胀腐蚀_第6张图片 闭运算

 

你可能感兴趣的:(Halcon,-,集合,Halcon)