mmocr.utils.poly_intersection¶
- mmocr.utils.poly_intersection(poly_a, poly_b, invalid_ret=None, return_poly=False)[源代码]¶
Calculate the intersection area between two polygons.
- 参数
poly_a (Polygon) – Polygon a.
poly_b (Polygon) – Polygon b.
invalid_ret (float or int, optional) – The return value when the invalid polygon exists. If it is not specified, the function allows the computation to proceed with invalid polygons by cleaning the their self-touching or self-crossing parts. Defaults to None.
return_poly (bool) – Whether to return the polygon of the intersection Defaults to False.
- 返回
Returns the intersection area or a tuple
(area, Optional[poly_obj])
, where the area is the intersection area between two polygons and poly_obj is The Polygon object of the intersection area, which will be None if the input is invalid. poly_obj will be returned only if return_poly is True.- 返回类型