Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def darker(input_path):
|
|
48 |
# Line processing
|
49 |
blurred = cv2.GaussianBlur(img_array, (5, 5), 0)
|
50 |
#darker
|
51 |
-
edges = cv2.Canny(blurred,
|
52 |
#lighter
|
53 |
# edges = cv2.Canny(blurred, 100, 180)
|
54 |
structuring_element = cv2.getStructuringElement(cv2.MORPH_RECT, (2,2))
|
@@ -61,7 +61,7 @@ def darker(input_path):
|
|
61 |
with gr.Blocks(analytics_enabled=False, theme=gr.themes.Soft()) as demo:
|
62 |
with gr.Row():
|
63 |
with gr.Column():
|
64 |
-
input = gr.Image(type="pil", label="Upload Image", sources=["upload"])
|
65 |
gr.ClearButton(components=input)
|
66 |
gr.Examples(examples=["hotel.jpg", "intersection.jpg", "road_small.jpg", "crash_small.jpg", "trailer.jpg"], inputs=input)
|
67 |
with gr.Column():
|
@@ -82,7 +82,7 @@ with gr.Blocks(analytics_enabled=False, theme=gr.themes.Soft()) as demo:
|
|
82 |
img_array = np.array(input_path)
|
83 |
# Line processing
|
84 |
blurred = cv2.GaussianBlur(img_array, (7, 7), 0)
|
85 |
-
edges = cv2.Canny(blurred,
|
86 |
structuring_element = cv2.getStructuringElement(cv2.MORPH_RECT, (2,2))
|
87 |
dilated_edges = cv2.dilate(edges, structuring_element, iterations=2)
|
88 |
line_drawing = 255 - dilated_edges
|
|
|
48 |
# Line processing
|
49 |
blurred = cv2.GaussianBlur(img_array, (5, 5), 0)
|
50 |
#darker
|
51 |
+
edges = cv2.Canny(blurred, 70, 120) #darker
|
52 |
#lighter
|
53 |
# edges = cv2.Canny(blurred, 100, 180)
|
54 |
structuring_element = cv2.getStructuringElement(cv2.MORPH_RECT, (2,2))
|
|
|
61 |
with gr.Blocks(analytics_enabled=False, theme=gr.themes.Soft()) as demo:
|
62 |
with gr.Row():
|
63 |
with gr.Column():
|
64 |
+
input = gr.Image(type="pil", label="Upload Image", sources=["upload", "clipboard"])
|
65 |
gr.ClearButton(components=input)
|
66 |
gr.Examples(examples=["hotel.jpg", "intersection.jpg", "road_small.jpg", "crash_small.jpg", "trailer.jpg"], inputs=input)
|
67 |
with gr.Column():
|
|
|
82 |
img_array = np.array(input_path)
|
83 |
# Line processing
|
84 |
blurred = cv2.GaussianBlur(img_array, (7, 7), 0)
|
85 |
+
edges = cv2.Canny(blurred, 90, 150)
|
86 |
structuring_element = cv2.getStructuringElement(cv2.MORPH_RECT, (2,2))
|
87 |
dilated_edges = cv2.dilate(edges, structuring_element, iterations=2)
|
88 |
line_drawing = 255 - dilated_edges
|