freealise commited on
Commit
2b4bae9
1 Parent(s): 5b248df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -434,7 +434,8 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
434
  #for i in range(l):
435
  # bg[(bg >= i*255/l) & (bg < (i+1)*255/l)] = i*255/(l-1)
436
  bg = cv2.convertScaleAbs(palette[bg]).astype(np.uint8) # Converting image back to uint
437
- bg[(mask>0) | (bg==255)] = 254
 
438
 
439
  params["fnum"] = frame_selected
440
  params["l"] = l
@@ -568,7 +569,7 @@ with gr.Blocks(css=css, js=js) as demo:
568
  with gr.Accordion(label="Edge", open=False):
569
  levels = gr.Slider(label="Color levels", value=16, maximum=32, minimum=2, step=1)
570
  tolerance = gr.Slider(label="Tolerance", value=1, maximum=7, minimum=0, step=1)
571
- bsize = gr.Slider(label="Border size", value=1, maximum=256, minimum=1, step=2)
572
  mouse = gr.Textbox(elem_id="mouse", value="""[]""", interactive=False)
573
  mouse.input(fn=draw_mask, show_progress="minimal", inputs=[levels, tolerance, mouse, output_mask], outputs=[output_mask])
574
  output_mask.apply(fn=apply_mask, inputs=[output_mask, bsize], outputs=[output_mask, depth_file])
 
434
  #for i in range(l):
435
  # bg[(bg >= i*255/l) & (bg < (i+1)*255/l)] = i*255/(l-1)
436
  bg = cv2.convertScaleAbs(palette[bg]).astype(np.uint8) # Converting image back to uint
437
+ bg[mask>0] = 254
438
+ bg[bg==255] = 254
439
 
440
  params["fnum"] = frame_selected
441
  params["l"] = l
 
569
  with gr.Accordion(label="Edge", open=False):
570
  levels = gr.Slider(label="Color levels", value=16, maximum=32, minimum=2, step=1)
571
  tolerance = gr.Slider(label="Tolerance", value=1, maximum=7, minimum=0, step=1)
572
+ bsize = gr.Slider(label="Border size", value=15, maximum=256, minimum=1, step=2)
573
  mouse = gr.Textbox(elem_id="mouse", value="""[]""", interactive=False)
574
  mouse.input(fn=draw_mask, show_progress="minimal", inputs=[levels, tolerance, mouse, output_mask], outputs=[output_mask])
575
  output_mask.apply(fn=apply_mask, inputs=[output_mask, bsize], outputs=[output_mask, depth_file])