Spaces:
Runtime error
Runtime error
Jyothish CHANDRASENAN
commited on
Commit
·
37e43b0
1
Parent(s):
010daaf
Update app.py
Browse files
app.py
CHANGED
@@ -129,10 +129,17 @@ def postprocessor(prediction, orig_img):
|
|
129 |
color = (255, 0, 0)
|
130 |
thickness = 1
|
131 |
result_image = cv2.circle(result_image, (x,y), radius=0, color=color, thickness=thickness)
|
132 |
-
result_image = cv2.putText(result_image,text[idx], (x-10,y+10), cv2.FONT_HERSHEY_SIMPLEX, 0.
|
133 |
-
|
|
|
134 |
result_image = cv2.line(result_image, points[0], points[1], (0,0,255), 1)
|
|
|
135 |
return result_image
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
|
138 |
def infer(preprocessed):
|
|
|
129 |
color = (255, 0, 0)
|
130 |
thickness = 1
|
131 |
result_image = cv2.circle(result_image, (x,y), radius=0, color=color, thickness=thickness)
|
132 |
+
result_image = cv2.putText(result_image,text[idx], (x-10,y+10), cv2.FONT_HERSHEY_SIMPLEX, 0.10, (255,0,0), thickness, cv2.LINE_AA)
|
133 |
+
|
134 |
+
distance = distanceCalculate(points[0], points[1])
|
135 |
result_image = cv2.line(result_image, points[0], points[1], (0,0,255), 1)
|
136 |
+
result_image = cv2.putText(result_image,distance, (points[0][0] - 10 ,points[0][1] + 10 ), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), thickness, cv2.LINE_AA)
|
137 |
return result_image
|
138 |
+
|
139 |
+
def distanceCalculate(p1, p2):
|
140 |
+
"""p1 and p2 in format (x1,y1) and (x2,y2) tuples"""
|
141 |
+
dis = ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5
|
142 |
+
return dis
|
143 |
|
144 |
|
145 |
def infer(preprocessed):
|