freealise commited on
Commit
5a87210
1 Parent(s): f2eaacb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -586,8 +586,6 @@ def draw_mask(l, t, b, v, d, evt: gr.EventData):
586
  if len(edge) == 0 or params["fnum"] != frame_selected or params["l"] != l:
587
  if len(edge) > 0:
588
  d["background"] = cv2.imread(depths[frame_selected]).astype(np.uint8)
589
- mask = cv2.imread(masks[frame_selected], cv2.IMREAD_GRAYSCALE).astype(np.uint8) + 128
590
- mask[mask==128] = 0
591
 
592
  bg = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
593
  bg[bg==255] = 0
@@ -595,7 +593,10 @@ def draw_mask(l, t, b, v, d, evt: gr.EventData):
595
  params["fnum"] = frame_selected
596
  params["l"] = l
597
 
 
 
598
  d["layers"][0] = cv2.cvtColor(mask, cv2.COLOR_GRAY2RGBA)
 
599
  edge = bg.copy()
600
  else:
601
  bg = edge.copy()
 
586
  if len(edge) == 0 or params["fnum"] != frame_selected or params["l"] != l:
587
  if len(edge) > 0:
588
  d["background"] = cv2.imread(depths[frame_selected]).astype(np.uint8)
 
 
589
 
590
  bg = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
591
  bg[bg==255] = 0
 
593
  params["fnum"] = frame_selected
594
  params["l"] = l
595
 
596
+ mask = cv2.imread(masks[frame_selected], cv2.IMREAD_GRAYSCALE).astype(np.uint8) + 128
597
+ mask[mask==128] = 0
598
  d["layers"][0] = cv2.cvtColor(mask, cv2.COLOR_GRAY2RGBA)
599
+
600
  edge = bg.copy()
601
  else:
602
  bg = edge.copy()