MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / order_points

Function order_points

app/services/tenvision_adapter.py:84–94  ·  view source on GitHub ↗
(points)

Source from the content-addressed store, hash-verified

82 diffs = np.diff(pts, axis=1).reshape(-1)
83 top_left = pts[np.argmin(sums)]
84 bottom_right = pts[np.argmax(sums)]
85 top_right = pts[np.argmin(diffs)]
86 bottom_left = pts[np.argmax(diffs)]
87 return np.array([top_left, top_right, bottom_right, bottom_left], dtype=np.float32)
88
89
90def poly_to_bbox(poly):
91 xs = poly[:, 0]
92 ys = poly[:, 1]
93 x1 = float(xs.min())
94 y1 = float(ys.min())
95 x2 = float(xs.max())
96 y2 = float(ys.max())
97 return int(round(x1)), int(round(y1)), int(round(x2 - x1)), int(round(y2 - y1))

Callers 1

ocr_itemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected