INNER CODE UNIT · Python

add_lost_frames

chonyy/ML-auto-baseball-pitching-overlay · src/get_pitch_frames.py:225

def add_lost_frames(frame_id, last_tracked_frame, frames, pitch_frames):
    if frame_id - last_tracked_frame > 1:
        print("Lost frames:", frame_id - last_tracked_frame)
        frames_to_add = frames[last_tracked_frame:frame_id]

        # Mark the detection in lost in this frame
        for ball_frame in frames_to_add:
            ball_frame.ball_lost_tracking = True
        pitch_frames.extend(frames_to_add)


# def get_bright_color():
#     h, s, l = random.random(), 0.5 + random.random()/2.0, 0.4 + random.random()/5.0
#     r, g, b = [int(256*i) for i in colorsys.hls_to_rgb(h, l, s)]
#     return [r, g, b]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…