From 377ca27cc98eb022c2067fa4c41dcec09b12666c Mon Sep 17 00:00:00 2001 From: Eric Criteser Date: Thu, 11 Jul 2024 18:00:46 -0500 Subject: [PATCH] change move_obb_boxesto accept array of arrays --- supervision/detection/utils.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 5f38905a..3d4fe8d5 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -612,17 +612,23 @@ def move_obb_boxes(xyxyxyxy, offset): import numpy as np import supervision as sv - xyxyxyxy: np.array([[10, 10, 20, 20, 30, 30, 40, 40], - [20, 20, 30, 30, 40, 40, 50, 50]]) + xyxyxyxy: np.array([[[10., 10.], + [20., 20.], + [30., 30.], + [40., 40.]]]) offset = np.array([5, 10]) sv.move_obb_boxes(xyxyxyxy=xyxyxyxy, offset=offset) - #[[15 20 25 30 35 40 45 50] - #[25 30 35 40 45 50 55 60]] + #[[[15., 20.], + #[25., 30.], + #[35., 40.], + #[45., 50.]]] ``` """ - return xyxyxyxy + np.hstack([offset, offset, offset, offset]) + return xyxyxyxy + np.hstack([offset, offset, offset, offset]).reshape( + xyxyxyxy.shape + ) def move_masks(