fffiloni commited on
Commit
a105c4f
1 Parent(s): fff1c2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -99,22 +99,22 @@ def infer(image_in):
99
  hull = cv2.convexHull(approx, returnPoints=False)
100
  sides = len(hull)
101
 
102
- #if 10 > sides > 3 and sides + 2 == len(approx):
103
- arrow_tip = find_tip(approx[:,0,:], hull.squeeze())
104
-
105
-
106
- if arrow_tip :
107
- cv2.drawContours(img, [cnt], -1, (0, 255, 0), 3)
108
- cv2.circle(img, arrow_tip, 3, (0, 0, 255), cv2.FILLED)
109
- arrow_tail = find_tail(approx[:,0,:], arrow_tip)
110
- if arrow_tail :
111
- arrows_coordinates.append([list(arrow_tail), list(arrow_tip)])
112
- cv2.circle(img, arrow_tail, 3, (255, 0, 0), cv2.FILLED)
113
- # Calculate length and angle
114
- arrow_length = get_length(arrow_tip, arrow_tail)
115
- arrow_angle = get_angle(arrow_tip, arrow_tail)
116
- # Draw arrow on the same blank image
117
- draw_arrow(img_result, arrow_tip, arrow_tail, arrow_length, arrow_angle)
118
 
119
 
120
 
 
99
  hull = cv2.convexHull(approx, returnPoints=False)
100
  sides = len(hull)
101
 
102
+ if 18 > sides > 3 and sides + 2 == len(approx):
103
+ arrow_tip = find_tip(approx[:,0,:], hull.squeeze())
104
+
105
+
106
+ if arrow_tip :
107
+ cv2.drawContours(img, [cnt], -1, (0, 255, 0), 3)
108
+ cv2.circle(img, arrow_tip, 3, (0, 0, 255), cv2.FILLED)
109
+ arrow_tail = find_tail(approx[:,0,:], arrow_tip)
110
+ if arrow_tail :
111
+ arrows_coordinates.append([list(arrow_tail), list(arrow_tip)])
112
+ cv2.circle(img, arrow_tail, 3, (255, 0, 0), cv2.FILLED)
113
+ # Calculate length and angle
114
+ arrow_length = get_length(arrow_tip, arrow_tail)
115
+ arrow_angle = get_angle(arrow_tip, arrow_tail)
116
+ # Draw arrow on the same blank image
117
+ draw_arrow(img_result, arrow_tip, arrow_tail, arrow_length, arrow_angle)
118
 
119
 
120