Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -401,12 +401,12 @@ def apply_mask(d, b):
|
|
401 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
402 |
mask = cv2.dilate(mask, dilation)
|
403 |
d["background"][mask==255] = (255,255,255,255)
|
404 |
-
mask = cv2.
|
405 |
|
406 |
for k, mk in enumerate(masks):
|
407 |
if k != frame_selected:
|
408 |
masks[k] = cv2.imread(depths[k])
|
409 |
-
masks[k][mask
|
410 |
|
411 |
masks[frame_selected] = d["background"]
|
412 |
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|
|
|
401 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
402 |
mask = cv2.dilate(mask, dilation)
|
403 |
d["background"][mask==255] = (255,255,255,255)
|
404 |
+
mask = cv2.inRange(d["background"], np.array([255,255,255,255]), np.array([255,255,255,255]))
|
405 |
|
406 |
for k, mk in enumerate(masks):
|
407 |
if k != frame_selected:
|
408 |
masks[k] = cv2.imread(depths[k])
|
409 |
+
masks[k][mask==0] = (255,255,255)
|
410 |
|
411 |
masks[frame_selected] = d["background"]
|
412 |
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|