BodyPoseTracker class
Allows access to Body Pose Tracking information.
Signature:
export declare class BodyPoseTracker extends ExternalObject
Extends: ExternalObject
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the BodyPoseTracker
class.
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
PoseUpdated | readonly | O3hEvent<readonly [readonly BodyPose[]]> | Gets an event which is raised continuously whenever the body tracking detects one or more people with information about their body position. |
TrackingAccuracy |
| typeof BodyPoseTrackingAccuracy | Control how accurate the body tracking is at the cost of processing time. |
Methods
Method | Modifiers | Description |
---|---|---|
destroy() | ||
start() | Starts the body pose tracker so that it begins detection. | |
stop() | Stops the service from processing body poses. | |
updatePollingFrequency(frequency) | Update the polling frequency of the body tracking, overriding the value set during the creation of the tracker. |
BodyPoseTracker.destroy() method
Signature:
destroy(): void;
Returns:
void
BodyPoseTracker.PoseUpdated property
Gets an event which is raised continuously whenever the body tracking detects one or more people with information about their body position.
Signature:
get PoseUpdated(): O3hEvent<readonly [readonly BodyPose[]]>;
Remarks
Each element in the array represents a different person detected.
Example
Example Usage
// Get the pose tracker for an existing cameraComponent layout component
const bodyPoseTracker = await o3h.Instance.getInputManager().getBodyPoseTracker(cameraComponent);
// Subscribe to the event that updates you with updates to body poses
bodyPoseTracker.PoseUpdatedEvent.add(posesUpdated);
bodyPoseTracker.start();
// Your callback function to handle the updated poses:
function posesUpdated(payload) {
// You receive an array of Body Poses, where 0 is the first person, 1 is the second person, etc.
const firstPose = payload.shift(); // Get the first person in all the poses given
console.log("First Pose (all details)", firstPose); // 16 body parts given
// Get information about the nose within the pose
const nosePosition = firstPose.BodyPartToPosition[o3h.BodyPart.Nose];
// Confidence is from 0 to 100 (integer)
console.log("Nose confidence", nosePosition.Confidence);
// Position is 2D based on the image provided; in pixels, integer values
console.log("Nose position", nosePosition.Position);
}
BodyPoseTracker.start() method
Starts the body pose tracker so that it begins detection.
Signature:
start(): void;
Returns:
void
Remarks
Be sure to subscribe to events first before starting.
BodyPoseTracker.stop() method
Stops the service from processing body poses.
Signature:
stop(): void;
Returns:
void
Remarks
Use this if you have long periods where you do not require the service as it will save battery.
BodyPoseTracker.TrackingAccuracy property
Warning: This API is now obsolete.
Control how accurate the body tracking is at the cost of processing time.
Signature:
static readonly TrackingAccuracy: typeof BodyPoseTrackingAccuracy;
Remarks
Higher accuracy models may not report a higher confidence score, however you should be more confident in their results anyway.
BodyPoseTracker.updatePollingFrequency() method
Update the polling frequency of the body tracking, overriding the value set during the creation of the tracker.
Signature:
updatePollingFrequency(frequency: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
frequency | number | How often to check for updates to the tracked body positions. |
Returns:
void
Updated over 1 year ago