INNER CODE UNIT · Python

color

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

            color = track_colors[t[4] % 12]
            centerX = int((t[0] + t[2]) / 2)
            centerY = int((t[1] + t[3]) / 2)
            tracked_balls.append([centerX, centerY, color])

        # Store the frames with ball tracked
        if len(trackings) > 0:
            # Only run at the first track from SORT
            if len(pitch_frames) == 0:
                last_tracked_frame = frame_id
                add_balls_before_SORT(
                    frames, detected_balls, tracked_balls, tracker_min_hits
                )
                # Add prior 20 frames before the first balsadl
                pitch_frames.extend(frames[-20:])

            # Add lost frames if any
            add_lost_frames(frame_id, last_tracked_frame, frames, pitch_frames)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…