File size: 733 Bytes
fb41312
88de542
fb41312
6aa96a4
 
88de542
 
 
 
fb41312
88de542
 
 
 
 
 
 
 
 
 
4d327e3
fb41312
882e081
 
 
 
fb41312
4d327e3
 
 
88de542
882e081
fb41312
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
import cv2

from pyAAMED import pyAAMED

title = """
<h1>Arc Adjacency Matrix based Fast Ellipse Detection</h1>
<a href="https://github.com/Li-Zhaoxi/AAMED">Gitub</a>
"""

def detect_ellipses(img_path):
    imgC = cv2.imread(img_path)
    imgG = cv2.cvtColor(imgC, cv2.COLOR_BGR2GRAY)

    aamed = pyAAMED(600, 600)

    aamed.setParameters(3.1415926/3, 3.4, 0.77)
    res = aamed.run_AAMED(imgG)
    print(res)

    return img_path

examples = [
    ["./AAMED/python/002_0038.jpg"]
]

gr.Interface(
    fn=detect_ellipses,
    inputs=gr.Image(label="Upload image with ellipses", type="filepath"),
    outputs=gr.Image(type="filepath", label="Detected ellipses"),
    title=title,
    examples=examples
).launch()