1.本文主要围绕Halcon圆拟合提取的学习心得总结,主要围绕halcon算子shape_trans,small_circle,fit_circle_contour_xld,hough_circles,add_metrology_object_circle_measure展开
2.Shape_trans
该算子检测图像变换区域中被广泛应用;
Signature
shape_trans(Region : RegionTrans : Type : )
Region (input_object) region(-array) →object
Regions to be transformed.
RegionTrans (output_object) region(-array) →object
Transformed regions.
Type (input_control) string →(string)
Type of transformation.
Default value: 'convex'
List of values: 'convex', 'ellipse', 'inner_center', 'inner_circle', 'inner_rectangle1','outer_circle', 'rectangle1', 'rectangle2'
Halcon例程1:
提取前图片 提取后图片
Halcon code
threshold (Image, Region, 0, 100)
closing_circle (Region, Region, 3.5)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, Ring, ['width','height'], 'and', [550,550], [750,750])
shape_trans (Ring, OuterCircle, 'outer_circle')
3.smallest_circle
该算子主要是拟合一个区域的小围绕圆
Signature
smallest_circle(Regions : : : Row, Column, Radius)
Regions (input_object) region(-array) →object
Regions to be examined.
Row (output_control) circle.center.y(-array) →(real)
Line index of the center.
Column (output_control) circle.center.x(-array) →(real)
Column index of the center.
Radius (output_control) circle.radius(-array) →(real)
Radius of the surrounding circle.
Assertion: Radius >= 0
Halcon例程2:
提取前图片 提取后图片
Halcon code
read_image (Image, 'circular_barcode')
get_image_size (Image, Width, Height)
threshold (Image, Region, 0, 100)
closing_circle (Region, Region, 3.5)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, Ring, ['width','height'], 'and', [550,550], [75