freealise commited on
Commit
e9ec958
1 Parent(s): 1494e64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -487,7 +487,10 @@ def apply_mask(d, b):
487
  masks[k] = cv2.imread(depths[k]).astype(np.uint8)
488
  masks[k][dmask<255] = (0,0,0)
489
 
490
- ksize = np.sqrt(np.sum(mask) / 255)
 
 
 
491
  frame = cv2.imread(frames[frame_selected]).astype(np.uint8)
492
  dmask = cv2.GaussianBlur(dmask, (ksize,ksize), 0)
493
  frame[3] = 255 - dmask
 
487
  masks[k] = cv2.imread(depths[k]).astype(np.uint8)
488
  masks[k][dmask<255] = (0,0,0)
489
 
490
+ ksize = int(np.sqrt(np.sum(mask) / 255))
491
+ if ksize/2 - int(ksize/2) == 0:
492
+ ksize = ksize + 1
493
+
494
  frame = cv2.imread(frames[frame_selected]).astype(np.uint8)
495
  dmask = cv2.GaussianBlur(dmask, (ksize,ksize), 0)
496
  frame[3] = 255 - dmask