Update app.py
Browse files
app.py
CHANGED
@@ -580,7 +580,7 @@ def draw_mask(l, t, th, v, d, evt: gr.EventData):
|
|
580 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (15-(t*2+1), 15-(t*2+1)), (t, t))
|
581 |
mask = cv2.dilate(mask, dilation)
|
582 |
|
583 |
-
bd = cv2.
|
584 |
|
585 |
#indices = np.arange(0,256) # List of all colors
|
586 |
#divider = np.linspace(0,255,l+1)[1] # we get a divider
|
@@ -973,7 +973,7 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
973 |
levels = gr.Slider(label="Color levels", value=16, maximum=32, minimum=2, step=1)
|
974 |
tolerance = gr.Slider(label="Tolerance", value=1, maximum=7, minimum=0, step=1)
|
975 |
bsize = gr.Slider(label="Border size", value=15, maximum=256, minimum=1, step=2)
|
976 |
-
threshold = gr.Slider(label="Threshold", value=
|
977 |
mouse = gr.Textbox(elem_id="mouse", value="""[]""", interactive=False)
|
978 |
mouse.input(fn=draw_mask, show_progress="minimal", inputs=[levels, tolerance, threshold, mouse, output_mask], outputs=[output_mask])
|
979 |
apply.click(fn=apply_mask, inputs=[output_mask, bsize], outputs=[output_mask, output_depth, output_frame])
|
|
|
580 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (15-(t*2+1), 15-(t*2+1)), (t, t))
|
581 |
mask = cv2.dilate(mask, dilation)
|
582 |
|
583 |
+
bd = cv2.Canny(bg, th, th*2, 5)
|
584 |
|
585 |
#indices = np.arange(0,256) # List of all colors
|
586 |
#divider = np.linspace(0,255,l+1)[1] # we get a divider
|
|
|
973 |
levels = gr.Slider(label="Color levels", value=16, maximum=32, minimum=2, step=1)
|
974 |
tolerance = gr.Slider(label="Tolerance", value=1, maximum=7, minimum=0, step=1)
|
975 |
bsize = gr.Slider(label="Border size", value=15, maximum=256, minimum=1, step=2)
|
976 |
+
threshold = gr.Slider(label="Threshold", value=64, maximum=128, minimum=0, step=1)
|
977 |
mouse = gr.Textbox(elem_id="mouse", value="""[]""", interactive=False)
|
978 |
mouse.input(fn=draw_mask, show_progress="minimal", inputs=[levels, tolerance, threshold, mouse, output_mask], outputs=[output_mask])
|
979 |
apply.click(fn=apply_mask, inputs=[output_mask, bsize], outputs=[output_mask, output_depth, output_frame])
|