freealise commited on
Commit
117e770
1 Parent(s): 12e552d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -364,16 +364,17 @@ def show_json(txt):
364
  return data[0]["video"]["path"], data[1]["path"], data[2], data[3]["background"]["path"], data[4], data[5]
365
 
366
 
367
- def select_frame(v, evt: gr.SelectData):
368
  global dcolor
369
  global frame_selected
370
  global masks
371
  global edge
372
 
373
  if evt.index != frame_selected:
374
- masks[frame_selected] = v
375
- frame_selected = evt.index
376
  edge = []
 
 
 
377
 
378
  if len(dcolor) == 0:
379
  bg = [127, 127, 127, 255]
 
364
  return data[0]["video"]["path"], data[1]["path"], data[2], data[3]["background"]["path"], data[4], data[5]
365
 
366
 
367
+ def select_frame(d, evt: gr.SelectData):
368
  global dcolor
369
  global frame_selected
370
  global masks
371
  global edge
372
 
373
  if evt.index != frame_selected:
 
 
374
  edge = []
375
+ mask = cv2.imread(depths[frame_selected]).astype(np.uint8)
376
+ cv2.imwrite(masks[frame_selected], cv2.cvtColor(mask, cv2.COLOR_RGB2GRAY))
377
+ frame_selected = evt.index
378
 
379
  if len(dcolor) == 0:
380
  bg = [127, 127, 127, 255]