Static Image Face Detection

Face Detection

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

stid_facepro_detector_create_handle

Function: Create a detector handle by loading a model file.

Note:

1, The the current SDK version does not support multi-threaded 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_detector_create_handle(
    stid_handle_t* out_handle,
    const char *alignment_model_filename,
    unsigned int config
);

Parameters:

Return:

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

stid_facepro_detector_destroy_handle

Function: Release handle.

Declaration:

STID_SDK_API
void
stid_facepro_detector_destroy_handle(
    stid_handle_t handle
);

Parameters:

  • [in] handle: Handle to be released.

stid_facepro_detector_detect

Function: Input a frame of image, return information including face frame and key points.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_detector_detect(
    stid_handle_t handle,
    const stid_image_t* input_image,
    stid_orientation_t face_orientation,
    stid_detection_result_t **out_detection_result_array,
    stid_landmarks_t **out_landmarks_array,
    int *out_face_count
);

Parameters:

  • [in] handle: Initialized handle.

  • [in] input_image: Input a frame of image.

  • [in] face_orientation: Specifies face orientation, a facing up image is preferred for efficiency purposes.

  • [out] out_detection_result_array: Return an array of face frame information, sorted by the rectangle size from large to small. The number of arrays is out_face_count; API is responsible for allocating memory, need to call stid_facepro_release_detection_results_array to release.

  • [out] out_landmarks_array: Return an array of detected face key points, the elements correspond to out_detection_result_array; API is responsible for allocating memory, need to call stid_facepro_release_landmarks_array to release.

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

Return:

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

stid_facepro_set_detector_threshold

Function: Setup the face frame detection threshold. Once set, the stid_facepro_detector_detect interface filters frames based on the score returned by the stid_detection_result_t structure. Face frames with a score of less than or equal to the threshold will not be returned.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_set_detector_threshold(
    stid_handle_t handle,
    float threshold
);

Parameters:

  • [in] handle: Initialized handle.

  • [in] threshold: Setup the threshold. Its valid range is (0.0, 1.0).

Return:

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

stid_facepro_release_detection_results_array

Function: Release face information array.

Declaration:

STID_SDK_API
void
stid_facepro_release_detection_results_array(
    const stid_detection_result_t *results_array,
    int results_array_size
);

Parameters:

  • [in] results_array: The beginning location of the face information array to be released.

  • [in] results_array_size: The size of face information arrays to be released.

stid_facepro_release_landmarks_array

Function: Release the detected face key points array.

Declaration:

STID_SDK_API
void
stid_facepro_release_landmarks_array(
    const stid_landmarks_t *landmarks_array,
    int landmarks_array_count
);

Parameters:

  • [in] landmarks_array: The beginning location of the face information array to be released.

  • [in] landmarks_array_count: The number of face information arrays to be released.

Last updated