#
C API Reference
The C API provides a plain C interface to the Face Verification Library, suitable for integration with C programs and other languages through FFI.
#
Opaque Types
#
FVLFaceVerifier
typedef struct FVLFaceVerifier FVLFaceVerifier;
Opaque handle to a FaceVerifier instance.
#
FVLFace
typedef struct FVLFace FVLFace;
Opaque handle to a Face instance.
#
FaceVerifier Functions
#
fvl_face_verifier_new
FVLFaceVerifier* fvl_face_verifier_new(const char* model_file, int max_concurrency, char** errorMessage);
Creates a new FaceVerifier instance. Loads the model file and sets up processing.
Returns: Pointer to the new instance, or NULL on failure.
#
fvl_face_verifier_free
void fvl_face_verifier_free(FVLFaceVerifier* verifier);
Frees a FaceVerifier instance.
#
fvl_face_verifier_detect_faces
void fvl_face_verifier_detect_faces(FVLFaceVerifier* verifier, const FVLImageHeader* image_header,
FVLDetectFacesCallback callback, void* user_data);
Detects faces on an image asynchronously. The callback is invoked with the result.
The image data is copied internally — it is safe to free the data after the call. This call is non-blocking.
#
fvl_face_verifier_embed_face
void fvl_face_verifier_embed_face(FVLFaceVerifier* verifier, const FVLFace* face,
FVLEmbedFaceCallback callback, void* user_data);
Computes the embedding of a detected face asynchronously.
#
fvl_face_verifier_compare_faces
FVLMatch fvl_face_verifier_compare_faces(FVLFaceVerifier* verifier,
const float* embedding1, int size1,
const float* embedding2, int size2);
Compares two face embeddings.
Returns: FVLMatch
#
fvl_face_verifier_get_concurrent_calculations
int fvl_face_verifier_get_concurrent_calculations(const FVLFaceVerifier* verifier);
Returns the approximate number of calculations currently in-flight.
Returns: int — number of concurrent calculations.
#
fvl_face_verifier_get_model_name
char* fvl_face_verifier_get_model_name(const FVLFaceVerifier* verifier);
Returns the name (version, etc.) of the loaded model.
Returns: char* — model name string. Caller must free() the returned string.
#
fvl_face_verifier_get_sdk_version
FVLVersion fvl_face_verifier_get_sdk_version();
Returns the SDK version.
Returns: FVLVersion
#
fvl_face_verifier_get_sdk_version_string
char* fvl_face_verifier_get_sdk_version_string();
Returns the SDK version as a string.
Returns: char* — version string. Caller must free() the returned string.
#
Face Functions
#
fvl_face_new
FVLFace* fvl_face_new(const FVLImageHeader* image_header, const FVLPoint2d* landmarks,
int num_landmarks, const FVLBoundingBox* bbox, float confidence,
char** errorMessage);
Creates a Face object to support 3rd party face detectors.
Returns: Pointer to the new Face instance, or NULL on failure.
#
fvl_face_copy
FVLFace* fvl_face_copy(const FVLFace* other);
Creates a copy of a Face instance.
Returns: Pointer to the new Face copy, or NULL on failure.
#
fvl_face_free
void fvl_face_free(FVLFace* face);
Frees a Face instance.
#
fvl_face_detection_quality
FVLDetectionQuality fvl_face_detection_quality(const FVLFace* face);
Returns the detection quality of the face.
Returns: FVLDetectionQuality
#
fvl_face_bounding_box
FVLBoundingBox fvl_face_bounding_box(const FVLFace* face);
Returns the bounding box of the face.
Returns: FVLBoundingBox
#
fvl_face_confidence
float fvl_face_confidence(const FVLFace* face);
Returns the confidence value of the face.
Returns: float — detection confidence.
#
fvl_face_landmarks
FVLPoint2dArray* fvl_face_landmarks(const FVLFace* face);
Returns the landmarks of the face.
Returns: FVLPoint2dArray* — landmark array. Caller must free() the returned array.
#
Data Types
#
FVLPoint2d
typedef struct FVLPoint2d {
float x;
float y;
} FVLPoint2d;
#
FVLPoint2dArray
typedef struct FVLPoint2dArray {
int count;
FVLPoint2d* points;
} FVLPoint2dArray;
#
FVLBoundingBox
typedef struct FVLBoundingBox {
int x;
int y;
int width;
int height;
} FVLBoundingBox;
#
FVLImageHeader
typedef struct FVLImageHeader {
const uint8_t* data;
int width;
int height;
int stride;
FVLImageFormat format;
} FVLImageHeader;
#
FVLMatch
typedef struct FVLMatch {
float similarity;
} FVLMatch;
#
FVLVersion
typedef struct FVLVersion {
int major;
int minor;
int patch;
} FVLVersion;
#
FVLFaceArray
typedef struct FVLFaceArray {
int count;
FVLFace** faces;
} FVLFaceArray;
#
FVLFloatArray
typedef struct FVLFloatArray {
int count;
float* data;
} FVLFloatArray;
#
Enumerations
#
FVLImageFormat
typedef enum FVLImageFormat {
FVLImageFormatGrayscale = 0,
FVLImageFormatRGB = 1,
FVLImageFormatRGBA = 2,
FVLImageFormatBGR = 3,
FVLImageFormatBGRA = 4,
} FVLImageFormat;
#
FVLDetectionQuality
typedef enum FVLDetectionQuality {
FVLDetectionQualityGood = 0,
FVLDetectionQualityBadQuality = 1,
FVLDetectionQualityMaybeRolled = 2,
} FVLDetectionQuality;
#
Callback Types
#
FVLDetectFacesCallback
typedef void (*FVLDetectFacesCallback)(void* user_data, FVLFaceArray* faces, const char* error_msg);
Callback for face detection results.
#
FVLEmbedFaceCallback
typedef void (*FVLEmbedFaceCallback)(void* user_data, FVLFloatArray* embedding, const char* error_msg);
Callback for face embedding results.
Important: The faces/embedding and error_msg parameters are only valid during the callback execution. Copy any data you need to retain before the callback returns.
#
Memory Management Summary
See also
Welcome to the Face Verification Library documentation!
The Face Verification Library is a portable C++ library for face verification, designed for real-time processing on client devices (mobile and
C99 compatible compiler