From 49d5f140848ef9a622e49e096ac144cac52ee0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C3=B3jcik?= Date: Mon, 24 Apr 2023 22:57:39 +0200 Subject: [PATCH] Support drawing rectangles for more than 2D --- motpy/testing_viz.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/motpy/testing_viz.py b/motpy/testing_viz.py index ed1d594..6c49dff 100644 --- a/motpy/testing_viz.py +++ b/motpy/testing_viz.py @@ -17,7 +17,9 @@ def draw_rectangle(img, box, color, thickness: int = 3) -> None: - cv2.rectangle(img, (int(box[0]), int(box[1])), (int(box[2]), int(box[3])), color, thickness) + x_min, y_min = int(box[0]), int(box[1]) + x_max, y_max = int(box[len(box) // 2]), int(box[len(box) // 2 + 1]) # for more than 2D + cv2.rectangle(img, (x_min, y_min), (x_max, y_max), color, thickness) def draw_text(img, text, pos, color=(255, 255, 255)) -> None: