fix(pre_commit): 🎨 auto format pre-commit hooks
This commit is contained in:
1 parent
79858ad9d3
commit
f307f981f6
3 files changed
+6
-12
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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]])
|
||||
|
||||
Reference in new issue
Block a user