freealise commited on
Commit
a94ded4
1 Parent(s): 5736df9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -403,14 +403,15 @@ def apply_mask(d, b):
403
  edge = []
404
  mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
405
  dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
406
- mask = cv2.dilate(mask, dilation)
 
407
  d["background"][mask==255] = (255,255,255,255)
408
  mask = cv2.inRange(d["background"], np.array([255,255,255,255]), np.array([255,255,255,255]))
409
 
410
  for k, mk in enumerate(masks):
411
  if k != frame_selected:
412
  masks[k] = cv2.imread(depths[k]).astype(np.uint8)
413
- masks[k][mask==0] = (255,255,255)
414
 
415
  masks[frame_selected] = d["background"]
416
  cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
 
403
  edge = []
404
  mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
405
  dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
406
+ dmask = cv2.dilate(mask, dilation)
407
+
408
  d["background"][mask==255] = (255,255,255,255)
409
  mask = cv2.inRange(d["background"], np.array([255,255,255,255]), np.array([255,255,255,255]))
410
 
411
  for k, mk in enumerate(masks):
412
  if k != frame_selected:
413
  masks[k] = cv2.imread(depths[k]).astype(np.uint8)
414
+ masks[k][dmask==0] = (255,255,255)
415
 
416
  masks[frame_selected] = d["background"]
417
  cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])