intersection_closed_contours_xld(Contours1, Contours2 : ContoursIntersection : : )
类似于difference_closed_contours_xld。
此函数用于计算Contours1, Contours2所对应闭合区域的交集部分,
结果交集的轮廓保存于ContoursIntersection 。
同样,halcon也自带有一例程
gen_ellipse_contour_xld (Contour1, 200, 200, 0, 100, 100, 0, 6.28318, 'positive', 1.5)
gen_ellipse_contour_xld (Contour2, 200, 300, 0, 100, 100, 0, 6.28318, 'positive', 1.5)
*
* Now, the intersection of the two regions is determined.
intersection_closed_contours_xld (Contour1, Contour2, ContoursIntersection)
*
* Visualization of the result
dev_set_line_width (5)
dev_set_color ('green')
dev_display (Contour1)
dev_set_color ('red')
dev_display (Contour2)
dev_set_line_width (3)
dev_set_color ('blue')
dev_display (ContoursIntersection)
stop ()
dev_clear_window ()
dev_set_line_width (1)
dev_set_color ('white')
*
* Now, boundary sets that define regions with holes are created.
gen_ellipse_contour_xld (Boundary1, 200, 200, 0, 100, 100, 0, 6.28318, 'positive', 1.5)
gen_ellipse_contour_xld (Hole1, 200, 200, 0, 75, 75, 0, 6.28318, 'positive', 1.5)
concat_obj (Boundary1, Hole1, BoundarySet1)
gen_ellipse_contour_xld (Boundary2, 200, 300, 0, 100, 100, 0, 6.28318, 'positive', 1.5)
gen_ellipse_contour_xld (Hole2, 200, 300, 0, 75, 75, 0, 6.28318, 'positive', 1.5)
concat_obj (Boundary2, Hole2, BoundarySet2)
*
* Now, the intersection of the two regions is determined.
intersection_closed_contours_xld (BoundarySet1, BoundarySet2, ContoursIntersection)
*
* Visualization of the result
dev_set_line_width (5)
dev_set_color ('green')
dev_display (BoundarySet1)
dev_set_color ('red')
dev_display (BoundarySet2)
dev_set_line_width (3)
dev_set_color ('blue')
dev_display (ContoursIntersection)
|