INNER CODE UNIT · Python
last_frame
chonyy/ML-auto-baseball-pitching-overlay · src/utils.py:60
last_frame = frame_list[lost_section[-1] + 1]
color = prev_frame.ball_color
lost_idx = [frame_list[i] for i in lost_section]
# Speed is the x difference for each frame
diff = last_frame.ball[0] - prev_frame.ball[0]
speed = int(diff / (len(lost_idx) + 1))
for idx, frame in enumerate(lost_idx):
x = prev_frame.ball[0] + (speed * (idx + 1))
y = int(poly(x))
frame.ball_in_frame = True
frame.ball = (x, y)
frame.ball_color = color
# print('Fill', x, y)