freealise commited on
Commit
0c1836b
1 Parent(s): 0cd2bd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
405
 
406
  for k, mk in enumerate(masks):
407
  if k != frame_selected:
408
  masks[k] = cv2.imread(depths[k])
409
- masks[k][mask!=255] = (255,255,255)
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])