INNER CODE UNIT · Python
y
chonyy/AI-basketball-analysis · src/utils.py:68
y = [height - ball[1] for ball in balls]
try:
params = curve_fit(fit_func, x, y)
[a, b, c] = params[0]
except:
print("fitting error")
a = 0
b = 0
c = 0
x_pos = np.arange(0, width, 1)
y_pos = [(a * (x_val ** 2)) + (b * x_val) + c for x_val in x_pos]
if(shotJudgement == "MISS"):
plt.plot(x, y, 'ro', figure=fig)
plt.plot(x_pos, y_pos, linestyle='-', color='red',
alpha=0.4, linewidth=5, figure=fig)
else: