INNER CODE UNIT · Python
modify_frames
chonyy/ML-auto-baseball-pitching-overlay · src/get_pitch_frames.py:211
modify_frames = frames[-(tracker_min_hits + 1) :]
balls_to_add_temp = copy.deepcopy(balls_to_add)
for point in balls_to_add_temp:
del point[2]
balls_to_add_temp = np.array(balls_to_add_temp, dtype="int32")
for idx, frame in enumerate(modify_frames):
# cv2.polylines(frame.frame, [balls_to_add_temp[:idx+1]], False, color, 22, lineType=cv2.LINE_AA)
frames[-((tracker_min_hits + 1) - idx)] = FrameInfo(
frame.frame, True, tuple(balls_to_add_temp[idx]), color
)
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]