From f307f981f6ffcbf5f962f59c04f0dbfa09e81343 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:05:01 +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/detection/tools/polygon_zone.py | 2 +- supervision/draw/utils.py | 12 +++++------- test/detection/test_polygon_zone_annotator.py | 4 ---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index 683ae3b5..2ca4d080 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -9,7 +9,7 @@ import numpy.typing as npt from supervision import Detections from supervision.detection.utils import clip_boxes, polygon_to_mask from supervision.draw.color import Color -from supervision.draw.utils import draw_polygon, draw_filled_polygon, draw_text +from supervision.draw.utils import draw_filled_polygon, draw_polygon, draw_text from supervision.geometry.core import Position from supervision.geometry.utils import get_polygon_center from supervision.utils.internal import SupervisionWarnings diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 4c5e30d6..678f3f66 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -59,7 +59,9 @@ def draw_rectangle( return scene -def draw_filled_rectangle(scene: np.ndarray, rect: Rect, color: Color, opacity: float = 1) -> np.ndarray: +def draw_filled_rectangle( + scene: np.ndarray, rect: Rect, color: Color, opacity: float = 1 +) -> np.ndarray: """ Draws a filled rectangle on an image. @@ -183,14 +185,10 @@ def draw_filled_polygon( np.ndarray: The scene with the polygon drawn on it. """ if opacity == 1: - cv2.fillPoly( - scene, [polygon], color=color.as_bgr() - ) + cv2.fillPoly(scene, [polygon], color=color.as_bgr()) else: scene_with_annotations = scene.copy() - cv2.fillPoly( - scene_with_annotations, [polygon], color=color.as_bgr() - ) + cv2.fillPoly(scene_with_annotations, [polygon], color=color.as_bgr()) cv2.addWeighted( scene_with_annotations, opacity, scene, 1 - opacity, gamma=0, dst=scene ) diff --git a/test/detection/test_polygon_zone_annotator.py b/test/detection/test_polygon_zone_annotator.py index 0408499e..d28a4eec 100644 --- a/test/detection/test_polygon_zone_annotator.py +++ b/test/detection/test_polygon_zone_annotator.py @@ -1,12 +1,8 @@ -from contextlib import ExitStack as DoesNotRaise - -import cv2 import numpy as np import pytest import supervision as sv - COLOR = sv.Color(r=255, g=0, b=0) THICKNESS = 2 POLYGON = np.array([[100, 100], [200, 100], [200, 200], [100, 200]])