INNER CODE UNIT · Python
xmax
chonyy/AI-basketball-analysis · src/utils.py:170
xmax = int((box[3] * width))
xCoor = int(np.mean([xmin, xmax]))
yCoor = int(np.mean([ymin, ymax]))
# Basketball (not head)
if(classes[0][i] == 1 and (distance([headX, headY], [xCoor, yCoor]) > 30)):
# recording shooting pose
if(distance([xCoor, yCoor], [handX, handY]) < 120):
shooting_pose['ball_in_hand'] = True
shooting_pose['knee_angle'] = min(
shooting_pose['knee_angle'], kneeAngle)
shooting_pose['elbow_angle'] = min(
shooting_pose['elbow_angle'], elbowAngle)
else:
shooting_pose['ball_in_hand'] = False
# During Shooting
if(ymin < (previous['hoop_height'])):