- make sure int for bboxes

- fixed displaying bbox
This commit is contained in:
2024-06-29 13:45:09 +02:00
parent 1c37eb6c2b
commit ece2900002
+5 -3
View File
@@ -15,8 +15,8 @@ def bbox_extend(bbox: cv2.typing.Rect, search_area: float):
he2 = int(round(bbox[3]*search_area/2))
res = (int(round(bbox[0]-we2)),)
res += (int(round(bbox[1]-he2)),)
res += (bbox[2]+2*we2,)
res += (bbox[3]+2*he2,)
res += (int(bbox[2]+2*we2),)
res += (int(bbox[3]+2*he2),)
return res
@@ -133,7 +133,9 @@ while True:
endY = startY + bbox[3]
# draw the bounding box on the image
cv2.rectangle(frame, (startX, startY), (endX, endY), (255, 0, 0), 3)
p1 = (int(bbox[0]), int(bbox[1]))
p2 = (int(bbox[0] + bbox[2]), int(bbox[1] + bbox[3]))
cv2.rectangle(frame, p1, p2, (255, 0, 0), 3)
# Calculate Frames per second (FPS)
fps = cv2.getTickFrequency() / (cv2.getTickCount() - timer)