dschandra commited on
Commit
e096673
·
verified ·
1 Parent(s): c4fc8b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -46,7 +46,19 @@ def process_video(video_path):
46
  cv2.line(frame, trajectory[i - 1], trajectory[i], (255, 0, 0), 2)
47
 
48
  # Draw stumps box
49
- stump_box = (width // 2 - 30, height - 120, width // 2 + 30, height - 50)
 
 
 
 
 
 
 
 
 
 
 
 
50
  cv2.rectangle(frame, stump_box[:2], stump_box[2:], (0, 255, 255), 2)
51
 
52
  # Draw projected path if enough points collected
 
46
  cv2.line(frame, trajectory[i - 1], trajectory[i], (255, 0, 0), 2)
47
 
48
  # Draw stumps box
49
+ # Automatically scale stump area depending on video height/width
50
+ box_width = int(width * 0.12) # 12% width for stumps
51
+ box_height = int(height * 0.1) # 10% height
52
+ stump_center_x = int(width * 0.5) # Middle of the frame
53
+ stump_top_y = int(height * 0.82) # Bottom 20% of frame (near pitch)
54
+
55
+ stump_box = (
56
+ stump_center_x - box_width // 2,
57
+ stump_top_y,
58
+ stump_center_x + box_width // 2,
59
+ stump_top_y + box_height
60
+ )
61
+
62
  cv2.rectangle(frame, stump_box[:2], stump_box[2:], (0, 255, 255), 2)
63
 
64
  # Draw projected path if enough points collected