From b86b660634d6037542472307c17e6594e6f6aec5 Mon Sep 17 00:00:00 2001 From: DivyaVijay1234 Date: Fri, 11 Oct 2024 16:56:22 +0530 Subject: [PATCH 1/5] feat-Added Default color --- supervision/draw/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 19ce4a258..50c911d4c 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -9,7 +9,7 @@ def draw_line( - scene: np.ndarray, start: Point, end: Point, color: Color, thickness: int = 2 + scene: np.ndarray, start: Point, end: Point, color: Color=Color(163, 81, 251), thickness: int = 2 ) -> np.ndarray: """ Draws a line on a given scene. @@ -35,7 +35,7 @@ def draw_line( def draw_rectangle( - scene: np.ndarray, rect: Rect, color: Color, thickness: int = 2 + scene: np.ndarray, rect: Rect, color: Color=Color(163, 81, 251), thickness: int = 2 ) -> np.ndarray: """ Draws a rectangle on an image. @@ -60,7 +60,7 @@ def draw_rectangle( def draw_filled_rectangle( - scene: np.ndarray, rect: Rect, color: Color, opacity: float = 1 + scene: np.ndarray, rect: Rect, color: Color=Color(163, 81, 251), opacity: float = 1 ) -> np.ndarray: """ Draws a filled rectangle on an image. @@ -151,7 +151,7 @@ def draw_rounded_rectangle( def draw_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color, thickness: int = 2 + scene: np.ndarray, polygon: np.ndarray, color: Color=Color(163, 81, 251), thickness: int = 2 ) -> np.ndarray: """Draw a polygon on a scene. @@ -171,7 +171,7 @@ def draw_polygon( def draw_filled_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color, opacity: float = 1 + scene: np.ndarray, polygon: np.ndarray, color: Color=Color(163, 81, 251), opacity: float = 1 ) -> np.ndarray: """Draw a filled polygon on a scene. From 5242614b01969b261f86982ee84db7a797dacac3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:38:20 +0000 Subject: [PATCH 2/5] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20?= =?UTF-8?q?format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 50c911d4c..beec3f31c 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -9,7 +9,11 @@ def draw_line( - scene: np.ndarray, start: Point, end: Point, color: Color=Color(163, 81, 251), thickness: int = 2 + scene: np.ndarray, + start: Point, + end: Point, + color: Color = Color(163, 81, 251), + thickness: int = 2, ) -> np.ndarray: """ Draws a line on a given scene. @@ -35,7 +39,10 @@ def draw_line( def draw_rectangle( - scene: np.ndarray, rect: Rect, color: Color=Color(163, 81, 251), thickness: int = 2 + scene: np.ndarray, + rect: Rect, + color: Color = Color(163, 81, 251), + thickness: int = 2, ) -> np.ndarray: """ Draws a rectangle on an image. @@ -60,7 +67,10 @@ def draw_rectangle( def draw_filled_rectangle( - scene: np.ndarray, rect: Rect, color: Color=Color(163, 81, 251), opacity: float = 1 + scene: np.ndarray, + rect: Rect, + color: Color = Color(163, 81, 251), + opacity: float = 1, ) -> np.ndarray: """ Draws a filled rectangle on an image. @@ -151,7 +161,10 @@ def draw_rounded_rectangle( def draw_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color=Color(163, 81, 251), thickness: int = 2 + scene: np.ndarray, + polygon: np.ndarray, + color: Color = Color(163, 81, 251), + thickness: int = 2, ) -> np.ndarray: """Draw a polygon on a scene. @@ -171,7 +184,10 @@ def draw_polygon( def draw_filled_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color=Color(163, 81, 251), opacity: float = 1 + scene: np.ndarray, + polygon: np.ndarray, + color: Color = Color(163, 81, 251), + opacity: float = 1, ) -> np.ndarray: """Draw a filled polygon on a scene. From a6897d4117447c28c2a2629d732177098cfc4fc0 Mon Sep 17 00:00:00 2001 From: DivyaVijay1234 Date: Fri, 11 Oct 2024 20:01:42 +0530 Subject: [PATCH 3/5] feat: add default color --- supervision/draw/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 50c911d4c..1c207b5df 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -9,7 +9,7 @@ def draw_line( - scene: np.ndarray, start: Point, end: Point, color: Color=Color(163, 81, 251), thickness: int = 2 + scene: np.ndarray, start: Point, end: Point, color: Color=Color.ROBOFLOW, thickness: int = 2 ) -> np.ndarray: """ Draws a line on a given scene. @@ -35,7 +35,7 @@ def draw_line( def draw_rectangle( - scene: np.ndarray, rect: Rect, color: Color=Color(163, 81, 251), thickness: int = 2 + scene: np.ndarray, rect: Rect, color: Color=Color.ROBOFLOW, thickness: int = 2 ) -> np.ndarray: """ Draws a rectangle on an image. @@ -60,7 +60,7 @@ def draw_rectangle( def draw_filled_rectangle( - scene: np.ndarray, rect: Rect, color: Color=Color(163, 81, 251), opacity: float = 1 + scene: np.ndarray, rect: Rect, color: Color=Color.ROBOFLOW, opacity: float = 1 ) -> np.ndarray: """ Draws a filled rectangle on an image. @@ -151,7 +151,7 @@ def draw_rounded_rectangle( def draw_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color=Color(163, 81, 251), thickness: int = 2 + scene: np.ndarray, polygon: np.ndarray, color: Color=Color.ROBOFLOW, thickness: int = 2 ) -> np.ndarray: """Draw a polygon on a scene. @@ -171,7 +171,7 @@ def draw_polygon( def draw_filled_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color=Color(163, 81, 251), opacity: float = 1 + scene: np.ndarray, polygon: np.ndarray, color: Color=Color.ROBOFLOW, opacity: float = 1 ) -> np.ndarray: """Draw a filled polygon on a scene. From 7e7eb8bd5ae5e264ee5e57a0bc7f9220c447d8f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 14:35:04 +0000 Subject: [PATCH 4/5] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20?= =?UTF-8?q?format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 1c207b5df..643970280 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -9,7 +9,11 @@ def draw_line( - scene: np.ndarray, start: Point, end: Point, color: Color=Color.ROBOFLOW, thickness: int = 2 + scene: np.ndarray, + start: Point, + end: Point, + color: Color = Color.ROBOFLOW, + thickness: int = 2, ) -> np.ndarray: """ Draws a line on a given scene. @@ -35,7 +39,7 @@ def draw_line( def draw_rectangle( - scene: np.ndarray, rect: Rect, color: Color=Color.ROBOFLOW, thickness: int = 2 + scene: np.ndarray, rect: Rect, color: Color = Color.ROBOFLOW, thickness: int = 2 ) -> np.ndarray: """ Draws a rectangle on an image. @@ -60,7 +64,7 @@ def draw_rectangle( def draw_filled_rectangle( - scene: np.ndarray, rect: Rect, color: Color=Color.ROBOFLOW, opacity: float = 1 + scene: np.ndarray, rect: Rect, color: Color = Color.ROBOFLOW, opacity: float = 1 ) -> np.ndarray: """ Draws a filled rectangle on an image. @@ -151,7 +155,10 @@ def draw_rounded_rectangle( def draw_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color=Color.ROBOFLOW, thickness: int = 2 + scene: np.ndarray, + polygon: np.ndarray, + color: Color = Color.ROBOFLOW, + thickness: int = 2, ) -> np.ndarray: """Draw a polygon on a scene. @@ -171,7 +178,10 @@ def draw_polygon( def draw_filled_polygon( - scene: np.ndarray, polygon: np.ndarray, color: Color=Color.ROBOFLOW, opacity: float = 1 + scene: np.ndarray, + polygon: np.ndarray, + color: Color = Color.ROBOFLOW, + opacity: float = 1, ) -> np.ndarray: """Draw a filled polygon on a scene. From c339315b318106e2a7bd760a4d0f20a1a39e1187 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Sat, 12 Oct 2024 18:58:45 +0300 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=E2=9C=A8=20set=20default=20colors?= =?UTF-8?q?=20for=20polygon=20drawing=20functions=20and=20add=20documentat?= =?UTF-8?q?ions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/tools/polygon_zone.py | 4 ++-- supervision/draw/utils.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index ac7203ff8..b8b728fc5 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -88,7 +88,7 @@ class PolygonZoneAnnotator: Attributes: zone (PolygonZone): The polygon zone to be annotated - color (Color): The color to draw the polygon lines + color (Color): The color to draw the polygon lines, default is white thickness (int): The thickness of the polygon lines, default is 2 text_color (Color): The color of the text on the polygon, default is black text_scale (float): The scale of the text on the polygon, default is 0.5 @@ -104,7 +104,7 @@ class PolygonZoneAnnotator: def __init__( self, zone: PolygonZone, - color: Color, + color: Color = Color.WHITE, thickness: int = 2, text_color: Color = Color.BLACK, text_scale: float = 0.5, diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 643970280..0c3767ff7 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -22,7 +22,7 @@ def draw_line( scene (np.ndarray): The scene on which the line will be drawn start (Point): The starting point of the line end (Point): The end point of the line - color (Color): The color of the line + color (Color): The color of the line, defaults to Color.ROBOFLOW thickness (int): The thickness of the line Returns: @@ -165,7 +165,7 @@ def draw_polygon( Parameters: scene (np.ndarray): The scene to draw the polygon on. polygon (np.ndarray): The polygon to be drawn, given as a list of vertices. - color (Color): The color of the polygon. + color (Color): The color of the polygon. Defaults to Color.ROBOFLOW. thickness (int): The thickness of the polygon lines, by default 2. Returns: @@ -188,7 +188,7 @@ def draw_filled_polygon( Parameters: scene (np.ndarray): The scene to draw the polygon on. polygon (np.ndarray): The polygon to be drawn, given as a list of vertices. - color (Color): The color of the polygon. + color (Color): The color of the polygon. Defaults to Color.ROBOFLOW. opacity (float): The opacity of polygon when drawn on the scene. Returns: