Spaces:
Running
Running
Gerold Meisinger commited on
Commit ·
1c48bcd
1
Parent(s): 444fff0
blub
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import cv2
|
| 3 |
+
|
| 4 |
+
ed = cv2.ximgproc.createEdgeDrawing()
|
| 5 |
+
params = cv2.ximgproc.EdgeDrawing.Params()
|
| 6 |
+
params.PFmode = True
|
| 7 |
+
ed.setParams(params)
|
| 8 |
+
|
| 9 |
+
def edpf(image_rgb):
|
| 10 |
+
img_gray = cv2.cvtColor(image_rgb, cv2.COLOR_BGR2GRAY)
|
| 11 |
+
edges = ed.detectEdges(img_gray)
|
| 12 |
+
edge_map = ed.getEdgeImage(edges)
|
| 13 |
+
return edge_map
|
| 14 |
+
|
| 15 |
+
demo = gr.Interface(edpf, gr.Image(shape=(512, 512)), "image")
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
demo.launch()
|