BodyData Class Reference

Class containing data of a detected body/person such as its bounding_box, id and its 3D position. More...

Functions

 BodyData ()
 Default constructor. More...
 
 ~BodyData ()
 Default destructor. More...
 

Attributes

int id
 Body/person identification number. More...
 
String unique_object_id
 Unique id to help identify and track AI detections. More...
 
OBJECT_TRACKING_STATE tracking_state
 Body/person tracking state. More...
 
OBJECT_ACTION_STATE action_state
 Body/person action state. More...
 
sl::float3 position
 Body/person 3D centroid. More...
 
sl::float3 velocity
 Body/person 3D velocity. More...
 
float position_covariance [6]
 Covariance matrix of the 3D position. More...
 
std::vector< sl::uint2 > bounding_box_2d
 2D bounding box of the body/person represented as four 2D points starting at the top left corner and rotation clockwise. More...
 
sl::Mat mask
 Mask defining which pixels which belong to the body/person (in bounding_box_2d and set to 255) and those of the background (set to 0). More...
 
float confidence
 Detection confidence value of the body/person. More...
 
std::vector< sl::float3 > bounding_box
 3D bounding box of the body/person represented as eight 3D points. More...
 
sl::float3 dimensions
 3D body/person dimensions: width, height, length. More...
 
std::vector< sl::float2 > keypoint_2d
 Set of useful points representing the human body in 2D. More...
 
std::vector< sl::float3 > keypoint
 Set of useful points representing the human body in 3D. More...
 
std::vector< sl::uint2 > head_bounding_box_2d
 2D bounding box of the head of the body/person represented as four 2D points starting at the top left corner and rotation clockwise. More...
 
std::vector< sl::float3 > head_bounding_box
 3D bounding box of the head of the body/person represented as eight 3D points. More...
 
sl::float3 head_position
 3D centroid of the head of the body/person. More...
 
std::vector< float > keypoint_confidence
 Vector of detection confidences for each keypoint. More...
 
std::vector< std::array< float, 6 > > keypoint_covariances
 Vector of detection covariance for each keypoint. More...
 
std::vector< sl::float3 > local_position_per_joint
 Vector of local position (position of the child keypoint with respect to its parent expressed in its parent coordinate frame) for each keypoint. More...
 
std::vector< sl::float4 > local_orientation_per_joint
 Vector of local orientation for each keypoint. More...
 
sl::float4 global_root_orientation
 Global root orientation of the skeleton. More...
 

Detailed Description

Class containing data of a detected body/person such as its bounding_box, id and its 3D position.

Constructor and Destructor

◆ BodyData()

BodyData ( )

Default constructor.

◆ ~BodyData()

~BodyData ( )

Default destructor.

Variables

◆ id

int id

Body/person identification number.

It is used as a reference when tracking the body through the frames.

Note
Only available if sl::BodyTrackingParameters.enable_tracking is activated.
Otherwise, it will be set to -1.

◆ unique_object_id

String unique_object_id

Unique id to help identify and track AI detections.

It can be either generated externally, or by using generate_unique_id() or left empty.

◆ tracking_state

OBJECT_TRACKING_STATE tracking_state

Body/person tracking state.

◆ action_state

OBJECT_ACTION_STATE action_state

Body/person action state.

◆ position

sl::float3 position

Body/person 3D centroid.

Note
It is defined in sl::InitParameters.coordinate_units and expressed in sl::RuntimeParameters.measure3D_reference_frame.

◆ velocity

sl::float3 velocity

Body/person 3D velocity.

Note
It is defined in sl::InitParameters.coordinate_units / s and expressed in sl::RuntimeParameters.measure3D_reference_frame.

◆ position_covariance

float position_covariance[6]

Covariance matrix of the 3D position.

Note
It is represented by its upper triangular matrix value
= [p0, p1, p2]
[p1, p3, p4]
[p2, p4, p5]
where pi is position_covariance[i]

◆ bounding_box_2d

std::vector<sl::uint2> bounding_box_2d

2D bounding box of the body/person represented as four 2D points starting at the top left corner and rotation clockwise.

Note
Expressed in pixels on the original image resolution, [0, 0] is the top left corner.
A ------ B
| Object |
D ------ C

◆ mask

sl::Mat mask

Mask defining which pixels which belong to the body/person (in bounding_box_2d and set to 255) and those of the background (set to 0).

Warning
The mask information is only available for tracked bodies (sl::OBJECT_TRACKING_STATE::OK) that have a valid depth.
Otherwise, the mask will not be initialized (mask.isInit() == false).

◆ confidence

float confidence

Detection confidence value of the body/person.

From 0 to 100, a low value means the body might not be localized perfectly.

◆ bounding_box

std::vector<sl::float3> bounding_box

3D bounding box of the body/person represented as eight 3D points.

Note
It is defined in sl::InitParameters.coordinate_units and expressed in sl::RuntimeParameters.measure3D_reference_frame.
1 ------ 2
/ /|
0 ------ 3 |
| Object | 6
| |/
4 ------ 7

◆ dimensions

sl::float3 dimensions

3D body/person dimensions: width, height, length.

Note
It is defined in sl::InitParameters.coordinate_units and expressed in sl::RuntimeParameters.measure3D_reference_frame.

◆ keypoint_2d

std::vector<sl::float2> keypoint_2d

Set of useful points representing the human body in 2D.

Note
Expressed in pixels on the original image resolution, [0, 0] is the top left corner.
Warning
In some cases, eg. body partially out of the image, some keypoints can not be detected. They will have negatives coordinates.

◆ keypoint

std::vector<sl::float3> keypoint

Set of useful points representing the human body in 3D.

Note
They are defined in sl::InitParameters.coordinate_units and expressed in sl::RuntimeParameters.measure3D_reference_frame.
Warning
In some cases, eg. body partially out of the image or missing depth data, some keypoints can not be detected. They will have non finite values.

◆ head_bounding_box_2d

std::vector<sl::uint2> head_bounding_box_2d

2D bounding box of the head of the body/person represented as four 2D points starting at the top left corner and rotation clockwise.

Note
Expressed in pixels on the original image resolution, [0, 0] is the top left corner.

◆ head_bounding_box

std::vector<sl::float3> head_bounding_box

3D bounding box of the head of the body/person represented as eight 3D points.

Note
It is defined in sl::InitParameters.coordinate_units and expressed in sl::RuntimeParameters.measure3D_reference_frame.

◆ head_position

sl::float3 head_position

3D centroid of the head of the body/person.

Note
It is defined in sl::InitParameters.coordinate_units and expressed in sl::RuntimeParameters.measure3D_reference_frame.

◆ keypoint_confidence

std::vector<float> keypoint_confidence

Vector of detection confidences for each keypoint.

Note
They can not be lower than the sl::BodyTrackingRuntimeParameters.detection_confidence_threshold.
Warning
In some cases, eg. body partially out of the image or missing depth data, some keypoints can not be detected. They will have non finite values.

◆ keypoint_covariances

std::vector<std::array<float, 6 > > keypoint_covariances

Vector of detection covariance for each keypoint.

Warning
In some cases, eg. body partially out of the image or missing depth data, some keypoints can not be detected. Their covariances will be 0.

◆ local_position_per_joint

std::vector<sl::float3> local_position_per_joint

Vector of local position (position of the child keypoint with respect to its parent expressed in its parent coordinate frame) for each keypoint.

Note
They are expressed in sl::REFERENCE_FRAME::CAMERA or sl::REFERENCE_FRAME::WORLD.
Warning
Not available with sl::BODY_FORMAT::BODY_18.

◆ local_orientation_per_joint

std::vector<sl::float4> local_orientation_per_joint

Vector of local orientation for each keypoint.

Note
The orientation is represented by a quaternion stored in a sl::float4 (sl::float4 q = sl::float4(qx, qy, qz, qw);)
Warning
Not available with sl::BODY_FORMAT::BODY_18.

◆ global_root_orientation

sl::float4 global_root_orientation

Global root orientation of the skeleton.

The orientation is also represented by a quaternion with the same format as local_orientation_per_joint.

Note
The global root position is already accessible in keypoint attribute by using the root index of a given sl::BODY_FORMAT.
Warning
Not available with sl::BODY_FORMAT::BODY_18.