Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,6 +46,8 @@ def infer(image_in):
|
|
46 |
img = cv2.imread(image_in)
|
47 |
|
48 |
contours, hierarchy = cv2.findContours(preprocess(img), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
|
|
|
|
49 |
|
50 |
for cnt in contours:
|
51 |
peri = cv2.arcLength(cnt, True)
|
@@ -53,6 +55,10 @@ def infer(image_in):
|
|
53 |
hull = cv2.convexHull(approx, returnPoints=False)
|
54 |
sides = len(hull)
|
55 |
|
|
|
|
|
|
|
|
|
56 |
if 6 > sides > 3 and sides + 2 == len(approx):
|
57 |
arrow_tip = find_tip(approx[:,0,:], hull.squeeze())
|
58 |
if arrow_tip:
|
|
|
46 |
img = cv2.imread(image_in)
|
47 |
|
48 |
contours, hierarchy = cv2.findContours(preprocess(img), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
49 |
+
print(f"contours: {contours}")
|
50 |
+
print(f"hierarchy: {hierarchy}")
|
51 |
|
52 |
for cnt in contours:
|
53 |
peri = cv2.arcLength(cnt, True)
|
|
|
55 |
hull = cv2.convexHull(approx, returnPoints=False)
|
56 |
sides = len(hull)
|
57 |
|
58 |
+
print(f"""
|
59 |
+
peri: {peri} | approx: {approx} | hull: {hull} | sides: {sides}
|
60 |
+
""")
|
61 |
+
|
62 |
if 6 > sides > 3 and sides + 2 == len(approx):
|
63 |
arrow_tip = find_tip(approx[:,0,:], hull.squeeze())
|
64 |
if arrow_tip:
|