freealise commited on
Commit
395d233
·
verified ·
1 Parent(s): 91072fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -560,7 +560,7 @@ def reset_mask(d):
560
  backup = cv2.imread(backups[frame_selected]).astype(np.uint8)
561
  cv2.imwrite(frames[frame_selected], backup)
562
 
563
- d["layers"][0] = (0,0,0,0)
564
 
565
  return gr.ImageEditor(value=d)
566
 
@@ -579,13 +579,12 @@ def draw_mask(o, b, v, d, evt: gr.EventData):
579
  pts = pts.reshape((-1,1,2))
580
 
581
  if len(edge) == 0 or params["fnum"] != frame_selected:
582
- if len(edge) > 0:
583
  d["background"] = cv2.imread(depths[frame_selected]).astype(np.uint8)
 
584
 
585
  bg = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
586
  bg[bg==255] = 0
587
-
588
- params["fnum"] = frame_selected
589
 
590
  edge = bg.copy()
591
  else:
 
560
  backup = cv2.imread(backups[frame_selected]).astype(np.uint8)
561
  cv2.imwrite(frames[frame_selected], backup)
562
 
563
+ d["layers"][0] = np.zeros(d["layers"][0].shape[:2],np.uint8)
564
 
565
  return gr.ImageEditor(value=d)
566
 
 
579
  pts = pts.reshape((-1,1,2))
580
 
581
  if len(edge) == 0 or params["fnum"] != frame_selected:
582
+ if params["fnum"] != frame_selected:
583
  d["background"] = cv2.imread(depths[frame_selected]).astype(np.uint8)
584
+ params["fnum"] = frame_selected
585
 
586
  bg = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
587
  bg[bg==255] = 0
 
 
588
 
589
  edge = bg.copy()
590
  else: