mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-19 01:17:06 +03:00
improve readability
This commit is contained in:
parent
ed572b7c2b
commit
e1bb480462
@ -12,18 +12,17 @@ def order_points_clockwise(points):
|
|||||||
"""
|
"""
|
||||||
center = np.mean(points, axis=0)
|
center = np.mean(points, axis=0)
|
||||||
|
|
||||||
top_left = points[
|
top_left = top_right = bottom_right = bottom_left = None
|
||||||
np.logical_and(points[:, 0] < center[0], points[:, 1] < center[1])
|
|
||||||
][0]
|
for point in points:
|
||||||
top_right = points[
|
if point[0] < center[0] and point[1] < center[1] and top_left is None:
|
||||||
np.logical_and(points[:, 0] > center[0], points[:, 1] < center[1])
|
top_left = point
|
||||||
][0]
|
elif point[0] > center[0] and point[1] < center[1] and top_right is None:
|
||||||
bottom_right = points[
|
top_right = point
|
||||||
np.logical_and(points[:, 0] > center[0], points[:, 1] > center[1])
|
elif point[0] > center[0] and point[1] > center[1] and bottom_right is None:
|
||||||
][0]
|
bottom_right = point
|
||||||
bottom_left = points[
|
elif point[0] < center[0] and point[1] > center[1] and bottom_left is None:
|
||||||
np.logical_and(points[:, 0] < center[0], points[:, 1] > center[1])
|
bottom_left = point
|
||||||
][0]
|
|
||||||
|
|
||||||
return np.array([top_left, top_right, bottom_right, bottom_left])
|
return np.array([top_left, top_right, bottom_right, bottom_left])
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user