From f872fddaffe2d34c11f2fcc62b6d1b53a28aec85 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:24:02 +0000 Subject: [PATCH] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20form?= =?UTF-8?q?at=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 4 +++- supervision/utils/image.py | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 854a9ece..ac901862 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1974,7 +1974,9 @@ class CropAnnotator(BaseAnnotator): (x1, y1), (x2, y2) = self.calculate_crop_coordinates( anchor=anchor, crop_wh=crop_wh, position=self.position ) - scene = overlay_image(scene=scene, inserted_image=resized_crop, anchor=(x1, y1)) + scene = overlay_image( + scene=scene, inserted_image=resized_crop, anchor=(x1, y1) + ) color = resolve_color( color=self.border_color, detections=detections, diff --git a/supervision/utils/image.py b/supervision/utils/image.py index b579ba75..f6eef9ca 100644 --- a/supervision/utils/image.py +++ b/supervision/utils/image.py @@ -275,7 +275,7 @@ def letterbox_image( letterboxed_image.size # (1000, 1000) ``` - + ![letterbox_image](https://media.roboflow.com/supervision-docs/letterbox-image.png){ align=center width="800" } """ # noqa E501 // docs color = unify_to_bgr(color=color) @@ -301,7 +301,7 @@ def letterbox_image( def overlay_image( image: npt.NDArray[np.uint8], overlay: npt.NDArray[np.uint8], - anchor: Tuple[int, int] + anchor: Tuple[int, int], ) -> npt.NDArray[np.uint8]: """ Places an image onto a scene at a given anchor point, handling cases where @@ -348,8 +348,9 @@ def overlay_image( crop_x_max = image_width - max((anchor_x + image_width) - scene_width, 0) crop_y_max = image_height - max((anchor_y + image_height) - scene_height, 0) - image[y_min:y_max, x_min:x_max] = \ - overlay[crop_y_min:crop_y_max, crop_x_min:crop_x_max] + image[y_min:y_max, x_min:x_max] = overlay[ + crop_y_min:crop_y_max, crop_x_min:crop_x_max + ] return image