MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / points2polygon

Function points2polygon

tools/utils/poly_nms.py:5–22  ·  view source on GitHub ↗

Convert k points to 1 polygon. Args: points (ndarray or list): A ndarray or a list of shape (2k) that indicates k points. Returns: polygon (Polygon): A polygon object.

(points)

Source from the content-addressed store, hash-verified

3
4
5def points2polygon(points):
6 """Convert k points to 1 polygon.
7
8 Args:
9 points (ndarray or list): A ndarray or a list of shape (2k)
10 that indicates k points.
11
12 Returns:
13 polygon (Polygon): A polygon object.
14 """
15 if isinstance(points, list):
16 points = np.array(points)
17
18 assert isinstance(points, np.ndarray)
19 assert (points.size % 2 == 0) and (points.size >= 8)
20
21 point_mat = points.reshape([-1, 2])
22 return Polygon(point_mat)
23
24
25def poly_intersection(poly_det, poly_gt, buffer=0.0001):

Callers 1

boundary_iouFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected