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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -387,8 +387,10 @@ def reset_mask():
387
  global frame_selected
388
  global masks
389
  global depths
 
390
 
391
- masks[frame_selected] = cv2.imread(depths[frame_selected])
 
392
  cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
393
  return masks[frame_selected], f"f{frame_selected}_dmap.png"
394
 
@@ -405,7 +407,7 @@ def apply_mask(d, b):
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"]
@@ -450,7 +452,7 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
450
  #for i in range(l):
451
  # bg[(bg >= i*255/l) & (bg < (i+1)*255/l)] = i*255/(l-1)
452
  bg = cv2.convertScaleAbs(palette[bg]).astype(np.uint8) # Converting image back to uint
453
- bg[mask>0] = 254
454
  bg[bg==255] = 254
455
 
456
  params["fnum"] = frame_selected
 
387
  global frame_selected
388
  global masks
389
  global depths
390
+ global edge
391
 
392
+ edge = []
393
+ masks[frame_selected] = cv2.imread(depths[frame_selected]).astype(np.uint8)
394
  cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
395
  return masks[frame_selected], f"f{frame_selected}_dmap.png"
396
 
 
407
 
408
  for k, mk in enumerate(masks):
409
  if k != frame_selected:
410
+ masks[k] = cv2.imread(depths[k]).astype(np.uint8)
411
  masks[k][mask==0] = (255,255,255)
412
 
413
  masks[frame_selected] = d["background"]
 
452
  #for i in range(l):
453
  # bg[(bg >= i*255/l) & (bg < (i+1)*255/l)] = i*255/(l-1)
454
  bg = cv2.convertScaleAbs(palette[bg]).astype(np.uint8) # Converting image back to uint
455
+ bg[mask>0] = 0
456
  bg[bg==255] = 254
457
 
458
  params["fnum"] = frame_selected