n1kkqt commited on
Commit
55f9eaa
β€’
1 Parent(s): 60f2c5c
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Corner Detection
3
- emoji: πŸƒ
4
  colorFrom: indigo
5
  colorTo: pink
6
  sdk: gradio
 
1
  ---
2
  title: Corner Detection
3
+ emoji: 🐌
4
  colorFrom: indigo
5
  colorTo: pink
6
  sdk: gradio
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import cv2
3
+ import glob
4
+ import gradio as gr
5
+
6
+ def shi_tomasi(image, max_corners=100, min_quality=0.01, min_dist=10):
7
+
8
+ gray_img = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
9
+ corners_img = cv2.goodFeaturesToTrack(gray_img,max_corners, min_quality, min_dist)
10
+ corners_img = np.int0(corners_img)
11
+
12
+ for corners in corners_img:
13
+ x,y = corners.ravel()
14
+ cv2.circle(image,(x,y),3,[0,255,0],-1)
15
+
16
+ return image
17
+
18
+
19
+ demo = gr.Interface(
20
+ shi_tomasi,
21
+ inputs=[gr.inputs.Image(type="numpy"),
22
+ gr.Slider(0, 2000, value=100, step=1, label='Maximum Number of Corners'),
23
+ gr.Slider(0.01, 0.99, value=0.01, step=0.01, label='Minimum Corner Quality'),
24
+ gr.Slider(0, 100, value=10, step=1, label='Minumum Euclidean Distance Between Corners'),
25
+ ],
26
+ outputs=gr.outputs.Image(type="numpy"),
27
+ title="Corner Detection",
28
+ description="Shi-Tomasi Corner Detection",
29
+ examples=list(map(lambda x: [x, 100, 0.01, 10], glob.glob('./examples/*.jpg'))),
30
+ allow_flagging="never",
31
+
32
+ )
33
+
34
+
35
+ if __name__ == "__main__":
36
+ demo.launch()
examples/interior (1).jpg ADDED
examples/interior (2).jpg ADDED
examples/interior (3).jpg ADDED
examples/interior (4).jpg ADDED
examples/interior (5).jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ opencv-python