BodyTrackingParameters Struct Reference

Structure containing a set of parameters for the body tracking module. More...

Functions

 BodyTrackingParameters (bool enable_tracking_=true, bool enable_segmentation_=false, BODY_TRACKING_MODEL detection_model=BODY_TRACKING_MODEL::HUMAN_BODY_ACCURATE, bool enable_body_fitting_=false, float max_range_=-1.f, BODY_FORMAT body_format_=BODY_FORMAT::BODY_18, BODY_KEYPOINTS_SELECTION body_selection=BODY_KEYPOINTS_SELECTION::FULL, float prediction_timeout_s=0.2f, bool allow_reduced_precision_inference=false, unsigned int instance_id=0)
 Default constructor. More...
 
bool save (String filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Saves the current set of parameters into a file to be reloaded with the load() method. More...
 
bool load (String filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Loads a set of parameters from the values contained in a previously saved file. More...
 
bool encode (String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string. More...
 
bool decode (const String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Fill the structure from the serialized json object contained in the input string. More...
 
bool operator== (const BodyTrackingParameters &param1) const
 
bool operator!= (const BodyTrackingParameters &param1) const
 

Attributes

unsigned int instance_module_id = 0
 Id of the module instance. More...
 
bool enable_tracking = true
 Whether the body tracking system includes body/person tracking capabilities across a sequence of images. More...
 
bool enable_segmentation = false
 Whether the body/person masks will be computed. More...
 
BODY_TRACKING_MODEL detection_model = BODY_TRACKING_MODEL::HUMAN_BODY_ACCURATE
 sl::BODY_TRACKING_MODEL to use. More...
 
bool enable_body_fitting = false
 Whether to apply the body fitting. More...
 
BODY_FORMAT body_format = BODY_FORMAT::BODY_18
 Body format to be outputted by the ZED SDK with sl::Camera.retrieveBodies(). More...
 
BODY_KEYPOINTS_SELECTION body_selection = BODY_KEYPOINTS_SELECTION::FULL
 Selection of keypoints to outputted by the ZED SDK with sl::Camera.retrieveBodies(). More...
 
float max_range = -1.f
 Upper depth range for detections. More...
 
float prediction_timeout_s
 Prediction duration of the ZED SDK when an object is not detected anymore before switching its state to sl::OBJECT_TRACKING_STATE::SEARCHING. More...
 
bool allow_reduced_precision_inference
 Whether to allow inference to run at a lower precision to improve runtime and memory usage. More...
 

Detailed Description

Structure containing a set of parameters for the body tracking module.

The default constructor sets all parameters to their default settings.

Note
Parameters can be adjusted by the user.

Constructor and Destructor

◆ BodyTrackingParameters()

BodyTrackingParameters ( bool  enable_tracking_ = true,
bool  enable_segmentation_ = false,
BODY_TRACKING_MODEL  detection_model = BODY_TRACKING_MODEL::HUMAN_BODY_ACCURATE,
bool  enable_body_fitting_ = false,
float  max_range_ = -1.f,
BODY_FORMAT  body_format_ = BODY_FORMAT::BODY_18,
BODY_KEYPOINTS_SELECTION  body_selection = BODY_KEYPOINTS_SELECTION::FULL,
float  prediction_timeout_s = 0.2f,
bool  allow_reduced_precision_inference = false,
unsigned int  instance_id = 0 
)

Default constructor.

All the parameters are set to their default values.

Functions

◆ save()

bool save ( String  filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Saves the current set of parameters into a file to be reloaded with the load() method.

Parameters
filename: Name of the file which will be created to store the parameters (extension '.yml' will be added if not set).
Returns
True if the file was successfully saved, otherwise false.
Warning
For security reasons, the file must not already exist.
In case a file already exists, the method will return false and existing file will not be updated.

◆ load()

bool load ( String  filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Loads a set of parameters from the values contained in a previously saved file.

Parameters
filename: Path to the file from which the parameters will be loaded (extension '.yml' will be added at the end of the filename if not detected).
Returns
True if the file was successfully loaded, otherwise false.

◆ encode()

bool encode ( String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string.

Parameters
serialized_contentoutput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if file was successfully saved, otherwise false.

◆ decode()

bool decode ( const String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Fill the structure from the serialized json object contained in the input string.

Parameters
serialized_contentinput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if the decoding was successful, otherwise false.

◆ operator==()

bool operator== ( const BodyTrackingParameters param1) const

Comparison operator ==

Parameters
BodyTrackingParametersto compare
Returns
true if the two struct are identical

◆ operator!=()

bool operator!= ( const BodyTrackingParameters param1) const

Comparison operator !=

Parameters
BodyTrackingParametersto compare
Returns
true if the two struct are different

Variables

◆ instance_module_id

unsigned int instance_module_id = 0

Id of the module instance.

This is used to identify which body tracking module instance is used.

◆ enable_tracking

bool enable_tracking = true

Whether the body tracking system includes body/person tracking capabilities across a sequence of images.

◆ enable_segmentation

bool enable_segmentation = false

Whether the body/person masks will be computed.

◆ detection_model

BODY_TRACKING_MODEL detection_model = BODY_TRACKING_MODEL::HUMAN_BODY_ACCURATE

sl::BODY_TRACKING_MODEL to use.

◆ enable_body_fitting

bool enable_body_fitting = false

Whether to apply the body fitting.

◆ body_format

Body format to be outputted by the ZED SDK with sl::Camera.retrieveBodies().

◆ body_selection

Selection of keypoints to outputted by the ZED SDK with sl::Camera.retrieveBodies().

◆ max_range

float max_range = -1.f

Upper depth range for detections.

Default: -1.f (value set in sl::InitParameters.depth_maximum_distance)

Note
The value cannot be greater than sl::InitParameters.depth_maximum_distance and its unit is defined in sl::InitParameters.coordinate_units.

◆ prediction_timeout_s

float prediction_timeout_s

Prediction duration of the ZED SDK when an object is not detected anymore before switching its state to sl::OBJECT_TRACKING_STATE::SEARCHING.

It prevents the jittering of the object state when there is a short misdetection.
The user can define their own prediction time duration.

Note
During this time, the object will have sl::OBJECT_TRACKING_STATE::OK state even if it is not detected.
The duration is expressed in seconds.
Warning
prediction_timeout_s will be clamped to 1 second as the prediction is getting worse with time.
Setting this parameter to 0 disables the ZED SDK predictions.

◆ allow_reduced_precision_inference

bool allow_reduced_precision_inference

Whether to allow inference to run at a lower precision to improve runtime and memory usage.

It might increase the initial optimization time and could include downloading calibration data or calibration cache and slightly reduce the accuracy.

Note
The fp16 is automatically enabled if the GPU is compatible and provides a speed up of almost x2 and reduce memory usage by almost half, no precision loss.
This setting allow int8 precision which can speed up by another x2 factor (compared to fp16, or x4 compared to fp32) and half the fp16 memory usage, however some accuracy could be lost.
The accuracy loss should not exceed 1-2% on the compatible models.
The current compatible models are all sl::AI_MODELS::HUMAN_BODY_XXXX.