File size: 750 Bytes
4d5db42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Draws trajectory, pitch zones, and decision overlay on frames."""

import cv2
import numpy as np
from typing import List, Tuple


class OverlayGenerator:
    def __init__(self, config):
        self.cfg = config

    def draw(self, frame: np.ndarray, trajectory_pts: List[Tuple[int, int]], verdict: str):
        # Draw trajectory curve
        for i in range(1, len(trajectory_pts)):
            cv2.line(frame,
                     trajectory_pts[i - 1],
                     trajectory_pts[i],
                     (0, 0, 255), 2)
        # Draw verdict text
        cv2.putText(frame, f"Decision: {verdict}", (30, 40), cv2.FONT_HERSHEY_SIMPLEX, 1.0,
                    (0, 255, 0) if verdict == "OUT" else (0, 0, 255), 2)
        return frame