Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -387,9 +387,10 @@ def apply_mask(d, b):
|
|
387 |
global frame_selected
|
388 |
global masks
|
389 |
|
|
|
390 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
391 |
-
|
392 |
-
d["background"][
|
393 |
|
394 |
masks[frame_selected] = d["background"]
|
395 |
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|
|
|
387 |
global frame_selected
|
388 |
global masks
|
389 |
|
390 |
+
mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
|
391 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
392 |
+
mask = cv2.dilate(mask, dilation)
|
393 |
+
d["background"][mask==255] = (255,255,255,255)
|
394 |
|
395 |
masks[frame_selected] = d["background"]
|
396 |
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|