Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -1,11 +1,21 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
color = (0,
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
return frame
|
|
|
1 |
+
def overlay_decision_text(frame, impact_point, hit_stumps, has_impact):
|
2 |
+
decision = "NOT OUT"
|
3 |
+
color = (0, 255, 0)
|
4 |
+
|
5 |
+
if has_impact and hit_stumps:
|
6 |
+
decision = "OUT"
|
7 |
+
color = (0, 0, 255)
|
8 |
+
|
9 |
+
cv2.putText(frame, f"LBW DECISION: {decision}", (50, 150), cv2.FONT_HERSHEY_SIMPLEX, 2, color, 5)
|
10 |
+
|
11 |
+
if has_impact:
|
12 |
+
cv2.putText(frame, "✔️ Impact Detected", (50, 250), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
|
13 |
+
else:
|
14 |
+
cv2.putText(frame, "❌ No Pad Impact", (50, 250), cv2.FONT_HERSHEY_SIMPLEX, 1, (100, 100, 100), 2)
|
15 |
+
|
16 |
+
if hit_stumps:
|
17 |
+
cv2.putText(frame, "✔️ Ball Would Hit Stumps", (50, 300), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
|
18 |
+
else:
|
19 |
+
cv2.putText(frame, "❌ Ball Missed Stumps", (50, 300), cv2.FONT_HERSHEY_SIMPLEX, 1, (100, 100, 100), 2)
|
20 |
+
|
21 |
return frame
|