Body Tracking Overview

Open in ClaudeOpen in ChatGPT

The body tracking module focuses on detecting and tracking a person’s bones. A detected bone is represented by its two endpoints, also called keypoints. The ZED camera can provide 2D and 3D information on each detected keypoint. Furthermore, it produces the local rotation between neighboring bones.

This module requires a stereo camera equipped with an inertial sensor (IMU), such as the ZED 2/2i, ZED Mini, ZED X, ZED X Mini, ZED X Nano. The following cameras are not supported:

  • The original ZED (out of production), which has no built-in IMU.
  • The ZED X One GS/4K/S cameras, which are monocular.

How It Works

The overall process is very similar to the ZED SDK Object Detection module. They share some output information, such as the 3D position and 3D velocity of each person. The body tracking module also uses a neural network for keypoint detection and then relies on the depth and positional tracking modules of the ZED SDK to compute the final 3D position of each keypoint. The ZED SDK supports multiple body formats:

The BODY_18 body format contains 18 keypoints following the COCO18 skeleton representation

image

Each keypoint is indexed by an integer from 0 to 17:

keypoint indexkeypoint namekeypoint indexkeypoint name
0NOSE9RIGHT_KNEE
1NECK10RIGHT_ANKLE
2RIGHT_SHOULDER11LEFT_HIP
3RIGHT_ELBOW12LEFT_KNEE
4RIGHT_WRIST13LEFT_ANKLE
5LEFT_SHOULDER14RIGHT_EYE
6LEFT_ELBOW15LEFT_EYE
7LEFT_WRIST16RIGHT_EAR
8RIGHT_HIP17LEFT_EAR

The ZED SDK can output 3 levels of information: raw 2D/3D body detection, 3D body tracking and 3D body fitting.

2D/3D Body detection

The ZED SDK first uses the ZED camera image to infer all 2D bones and keypoints using neural networks. The SDK depth module and positional tracking module are then used together to extract the correct 3D position of each bone and keypoint.

3D body tracking

If tracking is enabled, the ZED SDK will assign an identity to each detected body over time. At the same time, by filtering the raw body detections, it will output a more stable 3D body estimation.

3D body fitting

Moreover, a user can enable fitting to unlock even more information about each identity. The fitting process uses the history of each tracked person to deduce all missing keypoints, relying on the human kinematic constraints used by the body tracking module. It can also extract the local rotation between a pair of neighboring bones by solving the inverse kinematics problem. This data is compatible with common avatar animation software, for example. Below is an example where BODY_FORMAT::BODY_34 was used to animate an avatar in Unreal.

Detection Outputs

Each detected person is stored as a structure in the ZED SDK called sl.BodyData.

Body DataDescriptionOutput
IDFixed ID for identifying an object over time.Integer
Unique Object IDUnique id to help identify and track AI detections.String
Tracking stateDefines if an object is currently tracked or lost.Ok, Off, Searching, Terminate
Action stateDefines if an object is currently idle or moving.Idle, Moving
PositionProvides the 3D position of the object according to the camera as a 3D vector (x,y,z).[x, y, z]
VelocityProvides the velocity of the object in space as a 3D vector (x,y,z).[vₓ, vᵧ, v_z]
Position covarianceCovariance matrix of the 3D position.array of 6 values
2D bounding boxDefines the box surrounding the object in the image represented as four 2D points.Four pixel coordinates
MaskDistinguishes the pixels that actually belong to the object from those of the background.Binary mask
Detection confidenceA lower confidence means the object might not be localized perfectly or that its label is uncertain.0 - 100
3D bounding boxDefines the box surrounding the object in space represented as eight 3D points.Eight 3D coordinates
DimensionsProvides the width, height and length of the object.[width, height, length]
2D keypointA set of useful points representing the human body, expressed in 2D.a vector of [x, y]
KeypointA set of useful points representing the human body, expressed in 3D.a vector of [x, y, z]
2D head bounding boxBounds the head with four 2D points.Four pixel coordinates
3D head bounding boxBounds the head with eight 3D points.Eight 3D coordinates
Head position3D head centroid[x, y, z]
Keypoint confidencePer keypoint detection confidencea vector of float
Keypoint covariancePer keypoint covariancea vector of 6 values array
Local position per jointLocal position of each keypointa vector of [x, y, z]
Local orientation per jointLocal rotation of each keypointa vector of [x, y, z, w]
Global root orientationGlobal root orientation of the Body[x, y, z, w]

For more information on Body Tracking, see the Using the API page.