INNER CODE UNIT · Python
last_ball
chonyy/ML-auto-baseball-pitching-overlay · src/utils.py:22
last_ball = tuple(trajectory[-1][:-1])
cv2.circle(frame, tuple(last_ball), 13, (255, 255, 255), -1)
return frame
def fill_lost_tracking(frame_list):
balls_x = [frame.ball[0] for frame in frame_list if frame.ball_in_frame]
balls_y = [frame.ball[1] for frame in frame_list if frame.ball_in_frame]
# print(balls_x)
# print(balls_y)
# Get the polynomial equation
curve = np.polyfit(balls_x, balls_y, 2)
poly = np.poly1d(curve)
lost_sections = []
in_lost = False