Spaces:
Runtime error
Runtime error
DerrylNessie
commited on
Commit
•
85f0f8f
1
Parent(s):
6ea63d9
Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,14 @@ def midpoint(x1, y1, x2, y2):
|
|
20 |
y_mid = int((y1 + y2)/2)
|
21 |
return (x_mid, y_mid)
|
22 |
|
23 |
-
def draw_boxes(
|
24 |
-
|
|
|
|
|
25 |
for bound in bounds:
|
26 |
p0, p1, p2, p3 = bound[0]
|
27 |
-
draw.
|
28 |
-
return (
|
29 |
|
30 |
def draw_mask(img, bounds):
|
31 |
mask = np.zeros(img.shape[:2], dtype="uint8")
|
|
|
20 |
y_mid = int((y1 + y2)/2)
|
21 |
return (x_mid, y_mid)
|
22 |
|
23 |
+
def draw_boxes(img, bounds, color='yellow', width=2):
|
24 |
+
|
25 |
+
mask = np.zeros(img.shape[:2], dtype="uint8")
|
26 |
+
draw = ImageDraw.Draw(mask)
|
27 |
for bound in bounds:
|
28 |
p0, p1, p2, p3 = bound[0]
|
29 |
+
draw.polygon((*p0, *p1, *p2, *p3), fill=255)
|
30 |
+
return (mask)
|
31 |
|
32 |
def draw_mask(img, bounds):
|
33 |
mask = np.zeros(img.shape[:2], dtype="uint8")
|