MLPose
Datatype for storing a pose detected by Pose Detector. MLPose contains an ArrayList of MLKeyPoint. If the full pose is detected, MLPose contains 17 keypoints for each body joint following the order below:
1. nose
2. left eye
3. right eye
4. left ear
5. right ear
6. left shoulder
7. right shoulder
8. left elbow
9. right elbow
10. left wrist
11. right wrist
12. left hip
13. right hip
14. left knee
15. right knee
16. left ankle
17. right ankle
Each MLKeyPoint in MLPose contains x, y coordinates of the keypoint as well as the confidence score (from 0 to 1) of each detected point.
Examples
void setup() {
// create a Pose Detector
PoseDetector detector = new PoseDetector(this);
// load image
PImage img = loadImage("pose_soccer.png");
// detect pose
MLPose pose = detector.predict(img);
println("There are " + pose.getKeyPoints().size() + " keypoints in the detected pose!");
}
void draw() {
// draw dots on left and right shoulders
stroke(27, 52, 122);
strokeWeight(8);
point(pose.getLeftShoulder().getX(), pose.getLeftShoulder().getY());
point(pose.getRightShoulder().getX(), pose.getRightShoulder().getY());
// connect the shoulders with a line
stroke(33, 33, 33);
strokeWeight(2);
line(pose.getLeftShoulder().getX(), pose.getLeftShoulder().getY(), pose.getRightShoulder().getX(), pose.getRightShoulder().getY());
}
Methods
getKeyPoints()
: ReturnsList<MLKeyPoint> keyPoints
, an ArrayList of MLKeyPoint for each body joint.getNose()
: ReturnsMLKeyPoint nose
, the position of a nose.getLeftEye()
: ReturnsMLKeyPoint leftEye
, the position of a left eye.getRightEye()
: ReturnsMLKeyPoint rightEye
, the position of a right eye.getLeftEar()
: ReturnsMLKeyPoint leftEar
, the position of a left ear.getRightEar()
: ReturnsMLKeyPoint rightEar
, the position of a right ear.getLeftShoulder()
: ReturnsMLKeyPoint leftShoulder
, the position of a left shoulder.getRightShoulder()
: ReturnsMLKeyPoint rightShoulder
, the position of a right shoulder.getLeftElbow()
: ReturnsMLKeyPoint leftElbow
, the position of a left elbow.getRightElbow()
: ReturnsMLKeyPoint rightElbow
, the position of a right elbow.getLeftWrist()
: ReturnsMLKeyPoint leftWrist
, the position of a left wrist.getRightWrist()
: ReturnsMLKeyPoint rightWrist
, the position of a right wrist.getLeftHip()
: ReturnsMLKeyPoint leftHip
, the position of a left hip.getRightHip()
: ReturnsMLKeyPoint rightHip
, the position of a right hip.getLeftKnee()
: ReturnsMLKeyPoint leftKnee
, the position of a left knee.getRightKnee()
: ReturnsMLKeyPoint RightKnee
, the position of a right knee.getLeftAnkle()
: ReturnsMLKeyPoint leftAnkle
, the position of a left ankle.getRightAnkle()
: ReturnsMLKeyPoint rightAnkle
, the position of a right ankle.