INNER CODE UNIT · Python
alpha
chonyy/ML-auto-baseball-pitching-overlay · src/generate_overlay.py:28
alpha = 1.0 / (list_idx + 2)
beta = 1.0 - alpha
corrected_frame = image_registration(
background_frame, overlay_frame, shifts, list_idx, width, height
)
background_frame = cv2.addWeighted(
corrected_frame, alpha, background_frame, beta, 0
)
# Prepare balls to draw
if overlay_frame.ball_in_frame:
balls_in_curves[list_idx + 1].append(
[
overlay_frame.ball[0],
overlay_frame.ball[1],
overlay_frame.ball_color,
]
)