Creates a PoseTracker
Defaults:
Data source for pose (ie device)
Id of pose from TFjs
Gets the bounding box of the pose, computed by 'landmarks'.
pose.box; // { x, y, width, height }
Returns an empty rectangle if there's no data
Returns the centroid of all the pose points
pose.centroid; // { x, y }
Returns {0.5,0.5} is data is missing
Returns how long since pose was updated
Returns the id of the sender of this pose
Returns the globally unique id of this pose (fromId-poseId)
Returns height of bounding box
Returns a CSS colour: hsl() based on the randomly-assigned hue
Returns the randomly-assigned hue (0..360)
Returns the middle of the pose bounding box
pose.middle; // { x, y }
Returns the id of the sender
Returns the original pose id from TFjs Warning: this may not be unique if there are multiple senders
Return width of bounding box
Returns all the PointTrackers (ie. landmark) for this pose.
for (const pt of pose.getPointTrackers()) {
// Do something with 'pt' (which tracks one individual landmark)
}
Returns a PointTracker for a given landmark by name or index.
// Eg. get tracker for the 'nose' landmark
const nose = pose.landmark(`nose`);
// Get the angle of nose movement since the start
const a = nose.angleFromStart();
// Get the distance of nose since start
const d = nose.distanceFromStart();
Returns the last position for a given landmark.
const pos = pose.landmarkValue(`nose`); // { x, y }
Throws an error if nameOrIndex
does not exist.
Update this pose with new information
PoseTracker keeps track of a landmarks for a single pose. This is useful for tracking the movement of a pose or its landmarks over time. It does this by making a PointTracker for each keypoint of a pose.
Example
When creating, the most useful tuning options are
sampleLimit
which governs how many of the most recent samples to keep, andstoreIntermediate
(true/false) to store intermediate data.Accessing keypoints
You can get the raw keypoint data from the pose
But the real power comes from getting the PointTracker for a keypoint, since it keeps track of not just the last data, but a whole trail of historical data for a given keypoint.
Once we have the PointTracker, there are a lot of things to access: