commit under new branch

This commit is contained in:
Eric Criteser
2024-07-13 08:18:47 -05:00
parent cea854edf5
commit c9d4f2b82e
2 changed files with 7 additions and 6 deletions
@@ -28,9 +28,9 @@ def move_detections(
(sv.Detections) repositioned Detections object.
"""
detections.xyxy = move_boxes(xyxy=detections.xyxy, offset=offset)
if "xyxyxyxy" in detections.data:
detections.data["xyxyxyxy"] = move_obb_boxes(
xyxyxyxy=detections.data["xyxyxyxy"], offset=offset
if "ORIENTED_BOX_COORDINATES" in detections.data:
detections.data["ORIENTED_BOX_COORDINATES"] = move_obb_boxes(
xyss=detections.data["ORIENTED_BOX_COORDINATES"], offset=offset
)
if detections.mask is not None:
if resolution_wh is None:
+4 -3
View File
@@ -596,7 +596,8 @@ def move_boxes(
return xyxy + np.hstack([offset, offset])
def move_obb_boxes(xyxyxyxy, offset):
def move_obb_boxes(xyss: npt.NDArray[np.float64], offset: npt.NDArray[np.int32]
) -> npt.NDArray[np.float64]:
"""
Parameters:
xyxyxyxy (npt.NDArray[np.float64]): An array of shape `(n, 4, 2)` containing the
@@ -619,7 +620,7 @@ def move_obb_boxes(xyxyxyxy, offset):
[40., 40.]]])
offset = np.array([5, 10])
sv.move_obb_boxes(xyxyxyxy=xyxyxyxy, offset=offset)
sv.move_obb_boxes(xyss, offset=offset)
#[[[15., 20.],
#[25., 30.],
#[35., 40.],
@@ -628,7 +629,7 @@ def move_obb_boxes(xyxyxyxy, offset):
"""
return [
xys + np.hstack([offset, offset, offset, offset]).reshape(xys.shape)
for xys in xyxyxyxy
for xys in xyss
]