INNER CODE UNIT · Python

angle

chonyy/AI-basketball-analysis · src/utils.py:98

    angle = np.arccos(cosine_angle)
    return round(np.degrees(angle), 2)


def getAngleFromDatum(datum):
    hipX, hipY, _ = datum.poseKeypoints[0][9]
    kneeX, kneeY, _ = datum.poseKeypoints[0][10]
    ankleX, ankleY, _ = datum.poseKeypoints[0][11]

    shoulderX, shoulderY, _ = datum.poseKeypoints[0][2]
    elbowX, elbowY, _ = datum.poseKeypoints[0][3]
    wristX, wristY, _ = datum.poseKeypoints[0][4]

    kneeAngle = calculateAngle(np.array([hipX, hipY]), np.array(
        [kneeX, kneeY]), np.array([ankleX, ankleY]))
    elbowAngle = calculateAngle(np.array([shoulderX, shoulderY]), np.array(
        [elbowX, elbowY]), np.array([wristX, wristY]))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…