kooku0 / BodyPoseEstimationAndroid

๐Ÿ™‹โ€โ™‚๏ธUse Body Pose Estimation to perform pose matching on Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

๐Ÿ™‹โ€โ™‚๏ธUse Body Pose Estimation to perform pose matching on Android

License:Apache License 2.0