not round too early

This commit is contained in:
2024-07-03 22:03:59 +02:00
parent 348624c6a2
commit 19d5aedf22
3 changed files with 13 additions and 13 deletions
+6 -7
View File
@@ -20,17 +20,16 @@ def bbox_add_position(bbox, bbox_add):
def bbox_round(src):
x = int(round(src[0]))
y = int(round(src[1]))
w = int(round(src[2]))
h = int(round(src[3]))
res = ()
for s in src:
res += (int(round(s)),)
return x, y, w, h
return res
def bbox_center(bbox):
x = round(bbox[0] + bbox[2]/2)
y = round(bbox[1] + bbox[3]/2)
x = bbox[0] + bbox[2]/2
y = bbox[1] + bbox[3]/2
return x, y