/BodyPoseEstimationAndroid

🙋‍♂️Use Body Pose Estimation to perform pose matching on Android

Apache License 2.0Apache-2.0

Body Pose Estimation - Android

Copyright (C) 2019 여름방학에는 인턴해야지

Features

Perform pose matching by inferencing body pose estimation model on Android device

  • Lightweight Model. Inference Tensorflow Lite model that can be used lightly on mobile devices.
  • Pose Matching. Perform pose matching by calculating the angle of each joint point.
  • Pose Registration. Register a pose that will be used on pose matching.

DEMOs

Requirements

  • Android Studio 3.1.x
  • Gradle 3.1.x
  • Android Support Library, revision 21 or newer

Algorithm

Pose Matching

The angles of the six edges of the input upper body are extracted and the angle and accuracy of the skeleton to be matched are measured.

Angle calculation

private double getAngle(float[][] resultArr, int index) {
    List<Integer> basePoints = BASE_ANGLE_LIST.get(index).getPoints();
    double thetaA, thetaB, thetaC;
    double temp, Angle;
    
    thetaA = Math.sqrt(Math.pow(resultArr[basePoints.get(0)][1] - resultArr[basePoints.get(2)][1], 2) +
                       Math.pow(resultArr[basePoints.get(0)][0] - resultArr[basePoints.get(2)][0], 2));
    thetaB = Math.sqrt(Math.pow(resultArr[basePoints.get(0)][1] - resultArr[basePoints.get(1)][1], 2) +
                       Math.pow(resultArr[basePoints.get(0)][0] - resultArr[basePoints.get(1)][0], 2));
    thetaC = Math.sqrt(Math.pow(resultArr[basePoints.get(1)][1] - resultArr[basePoints.get(2)][1], 2) +
                       Math.pow(resultArr[basePoints.get(1)][0] - resultArr[basePoints.get(2)][0], 2));

    temp = (Math.pow(thetaB, 2) + Math.pow(thetaC, 2) - Math.pow(thetaA, 2)) / (2 * thetaB * thetaC);
    Angle = Math.acos(temp);
    Angle = Angle * (180.0 / Math.PI);
    return Angle;
}

Accuracy calculation

private double getPersentage(double compareNumber, double betweenAngle) {
    return (((HALF_DEGREE - Math.abs(betweenAngle - compareNumber))) / HALF_DEGREE) * 100;
}

Contribution

  1. Fork it (http://github.com/koomg9599/BodyPoseEstimationAndroid)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Reference

License

Apache License 2.0