freealise commited on
Commit
2e1c921
1 Parent(s): 6ae9b9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -323,6 +323,8 @@ def select_frame(v, evt: gr.SelectData):
323
  if evt.index != frame_selected:
324
  masks[frame_selected] = v
325
  frame_selected = evt.index
 
 
326
 
327
  return masks[frame_selected], frame_selected
328
 
@@ -341,7 +343,7 @@ def draw_mask(v, d, evt: gr.EventData):
341
  vv = json.loads(v)
342
  pts = np.array(vv, np.int32)
343
  pts = pts.reshape((-1,1,2))
344
-
345
  d["layers"][0] = cv2.fillPoly(d["layers"][0], [pts], (0,0,0,255))
346
  d["composite"] = cv2.fillPoly(d["composite"], [pts], (0,0,0,255))
347
 
 
323
  if evt.index != frame_selected:
324
  masks[frame_selected] = v
325
  frame_selected = evt.index
326
+
327
+ masks[frame_selected] = masks[frame_selected] - (masks[len(masks)-1]-127)
328
 
329
  return masks[frame_selected], frame_selected
330
 
 
343
  vv = json.loads(v)
344
  pts = np.array(vv, np.int32)
345
  pts = pts.reshape((-1,1,2))
346
+
347
  d["layers"][0] = cv2.fillPoly(d["layers"][0], [pts], (0,0,0,255))
348
  d["composite"] = cv2.fillPoly(d["composite"], [pts], (0,0,0,255))
349