Monocular Face Tracking

Monocular Face Tracking

Windows/Linux/Arm_Linux interface is described here, for Android interface please refer to Android Interface Description.

stid_facepro_tracking_create_handle

Function: Create a handle by loading a model file

Note:

1, The SDK handle of the current version does not support multi-thread calls, if you need to call multiple threads for multiple times, multiple handles need to be created: a separate handle for each thread.

2, For each thread, the initialization function only needs to be called one time; subsequent face detection functions can be called multiple times without creating a new handle.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_tracking_create_handle(
    stid_handle_t* out_handle,
    const char *alignment_model_filename,
    unsigned int config
);

Parameters:

  • [out] out_handle: Return the initialized handle, when not in use, call destroy_handle to release resource.

  • [in] alignment_model_filename: Pass the location of the alignment model file.

  • [in] config: Setup configuration options for the detector. Set to 0 to use default configuration. The default configuration is: ST_DETECT_LARGE_FACE (large face mode) and single-threaded mode. The configuration can also be set to ST_DETECT_SMALL_FACE (small face mode), and STID_FACEPRO_TRACKING_CONFIG_ASYNC (async tracking mode). For detailed configuration parameters supported by the configuration options, please refer to Section 4.1.2: Structure and macro definition-> Face detection tracking configuration option macro definition.

Return: Return STID_OK if successful, otherwise return error code.

stid_facepro_destroy_tracker

Function: Release handle

Declaration:

STID_SDK_API
void
stid_facepro_tracking_destroy_handle(
    stid_handle_t handle
);

Parameters:

  • [in] handle: Handle to be released

Return: None

stid_facepro_tracking_reset

Function: Restart handle

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_tracking_reset(
    stid_handle_t handle
);

Parameters:

  • [in]handle: Handle to be restarted

Return: Return ST_OK if successful, otherwise return error type.

stid_facepro_tracking_track

Function: Input one frame of image for face tracking. Call this interface continuously to implement face tracking for continuous frames.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_tracking_track(
    stid_handle_t handle,
    const stid_image_t* input_image,
    stid_orientation_t face_orientation,
    double time_stamp_s,
    stid_target_t **out_targets_array,
    int *out_targets_array_count
);

Parameters:

  • [in] handle: Initialized handle

  • [in] input_image: Pass in a frame of image

  • [in] face_orientation: Specify face orientation

  • [in] time_stamp_s: Time stamp information of the frame, in seconds, floating point (decimal point represents the precision in seconds).

  • [out] out_targets_array: Return the detected face information array, API is responsible for allocating memory, need to call stid_facepro_tracking_release_targets_array to release.

  • [out] out_targets_array_count: Return the number of faces detected.

Return:

  • [return]Return STID_OK if successful, otherwise return error code.

stid_facepro_set_tracking_option

Function: Configure face detection options, support tracking handle

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_set_tracking_option(
stid_handle_t handle,
unsigned int option_type,
int value,
int* out_new_value
);

Parameters:

  • [in] handle: Initialized handle

  • [in] option_type: Specify configuration options. Valid configuration type currently supported is STID_FACEPRO_DETECTION_OPTION_TYPE_LIMIT, setting up the maximum number of targets to track.

  • [in] value: New value to be setup. According to the currently supported configuration type, the value indicates the maximum number of targets to be set, in the range of [1, 32].

  • [out] out_new_value: If not nullptr, the new value used is returned. Due to internal limitations, the actual value used may not be equal to value.

Return:

  • [return] Return STID_OK if successful, otherwise return error code.

stid_facepro_tracking_release_targets_array

Function: Release face detection information

Note:

1, Call this function after each call to the face tracking function to release resources.

Declaration:

STID_SDK_API
void
stid_facepro_tracking_release_targets_array(
    const stid_target_t *targets_array,
    int targets_array_count
);

Parameters:

  • [in] targets_array: Beginning location of the face information array to be released.

  • [in] targets_array_count Amount of face information arrays to be released.

Return: None

Last updated