Spaces:
Runtime error
Runtime error
Jyothish CHANDRASENAN
commited on
Commit
·
5b83031
1
Parent(s):
62b0bcf
Update app.py
Browse files
app.py
CHANGED
@@ -129,7 +129,7 @@ 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=2)
|
132 |
-
result_image = cv2.putText(result_image,text[idx], (x
|
133 |
|
134 |
distance = distanceCalculate(points[0], points[1])
|
135 |
midpoints = midpoint(points[0], points[1])
|
@@ -139,7 +139,7 @@ def postprocessor(prediction, orig_img):
|
|
139 |
|
140 |
def distanceCalculate(p1, p2):
|
141 |
"""p1 and p2 in format (x1,y1) and (x2,y2) tuples"""
|
142 |
-
dis = ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5
|
143 |
return dis
|
144 |
|
145 |
# midpoint of a line
|
|
|
129 |
color = (255, 0, 0)
|
130 |
thickness = 1
|
131 |
result_image = cv2.circle(result_image, (x,y), radius=0, color=color, thickness=2)
|
132 |
+
result_image = cv2.putText(result_image,text[idx], (x,y+10), cv2.FONT_HERSHEY_SIMPLEX, 0.25, (255,0,0), 1, cv2.LINE_AA)
|
133 |
|
134 |
distance = distanceCalculate(points[0], points[1])
|
135 |
midpoints = midpoint(points[0], points[1])
|
|
|
139 |
|
140 |
def distanceCalculate(p1, p2):
|
141 |
"""p1 and p2 in format (x1,y1) and (x2,y2) tuples"""
|
142 |
+
dis = round(((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5, 2)
|
143 |
return dis
|
144 |
|
145 |
# midpoint of a line
|