Halcon轮廓链接与分割

gen_rectangle2_contour_xld (Rectangle, 300, 200, 0, 100.5, 20.5)
get_contour_xld (Rectangle, Row, Col)
tuple_remove (Row, 4, Row)
tuple_remove (Col, 4, Col)
gen_contour_polygon_xld (Contour, Row, Col)
*将轮廓的两个端点连起来 不论连线是否与轮廓相交
close_contours_xld (Contour, ClosedContours)
***************例程segment_contours_xld ***************

read_image (Image, ‘pumpe’)
edges_sub_pix (Image, Edges, ‘canny’, 1.5, 15, 40)
*分割轮廓 分割为线 圆(弧) 椭圆(弧)
segment_contours_xld (Edges, ContoursSplit, ‘lines_circles’, 5, 4, 2)
select_contours_xld (ContoursSplit, SelectedContours, ‘contour_length’, 0.5, 200, -0.5, 0.5)
*按轮廓端点的距离 链接
union_adjacent_contours_xld (SelectedContours, UnionContours, 10, 1, ‘attr_keep’)
*链接同一直线上的轮廓
union_collinear_contours_xld (UnionContours, UnionContours1, 10, 1, 2, 0.1, ‘attr_keep’)
*链接同一圆周上的轮廓
union_cocircular_contours_xld (UnionContours1, UnionContours2, 0.5, 0.1, 0.2, 30, 10, 10, ‘true’, 1)

你可能感兴趣的:(halcon)