Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -9,17 +9,15 @@ incorrect = cv2.imread('wrong.png')
|
|
| 9 |
incorrect = cv2.cvtColor(incorrect, cv2.COLOR_BGR2RGB)
|
| 10 |
|
| 11 |
def draw_rounded_rect(img, rect_start, rect_end, corner_width, box_color):
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
box_color: The color of the rectangle in BGR format.
|
| 22 |
-
"""
|
| 23 |
|
| 24 |
|
| 25 |
x1, y1 = rect_start
|
|
@@ -49,16 +47,16 @@ def draw_rounded_rect(img, rect_start, rect_end, corner_width, box_color):
|
|
| 49 |
return img
|
| 50 |
|
| 51 |
def draw_dotted_line(frame, lm_coord, start, end, line_color):
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
|
| 63 |
pix_step = 0
|
| 64 |
|
|
|
|
| 9 |
incorrect = cv2.cvtColor(incorrect, cv2.COLOR_BGR2RGB)
|
| 10 |
|
| 11 |
def draw_rounded_rect(img, rect_start, rect_end, corner_width, box_color):
|
| 12 |
+
"""
|
| 13 |
+
This function draws a rectangle with rounded corners on an image.
|
| 14 |
+
Args:
|
| 15 |
+
img: The image to draw on.
|
| 16 |
+
rect_start: The top-left corner of the rectangle as a tuple (x1, y1).
|
| 17 |
+
rect_end: The bottom-right corner of the rectangle as a tuple (x2, y2).
|
| 18 |
+
corner_width: The width of the rounded corners.
|
| 19 |
+
box_color: The color of the rectangle in BGR format.
|
| 20 |
+
"""
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
x1, y1 = rect_start
|
|
|
|
| 47 |
return img
|
| 48 |
|
| 49 |
def draw_dotted_line(frame, lm_coord, start, end, line_color):
|
| 50 |
+
"""
|
| 51 |
+
This function draws a dotted line on a frame based on landmark coordinates.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
frame: The image to draw on.
|
| 55 |
+
lm_coord: The landmark coordinates as a NumPy array.
|
| 56 |
+
start: The index of the starting landmark in the lm_coord array.
|
| 57 |
+
end: The index of the ending landmark in the lm_coord array.
|
| 58 |
+
line_color: The color of the line in BGR format.
|
| 59 |
+
"""
|
| 60 |
|
| 61 |
pix_step = 0
|
| 62 |
|