#
C++ API Documentation
#
Tracker class
#
class fvl::FaceVerifier
The Face Verifier class
#
Constructors
FaceVerifier(const std::string& modelFile, int maxConcurrency = 0)
Constructor: loads model file, sets up the processing.
Parameters:
model_file- path for the used modelmax_concurrency- maximum allowed concurrency, 0 means automatic (using all cores), default: 0
~FaceVerifier()
Destructor
#
Methods
std::future<std::vector<fvl::Face>> detectFaces(const fvl::ImageHeader& imageHeader)
Detects the faces on an image with the std::future API.
Note: The given ImageHeader doesn't own the image data, and it is safe to delete the data after the call, a copy is happening internally. See fvl::ImageHeader for details.
Note: Calling this function is non-blocking, so calling it again with the next image without waiting for the result is possible. Also see getConcurrentCalculations().
Note: This is the std::future based API, for callback API see fvl::FaceVerifier::detectFaces(const fvl::ImageHeader&, std::function<void (ResultOrError<std::vector<Face>>)>).
Parameters:
imageHeader- image descriptor
void detectFaces(const fvl::ImageHeader& imageHeader,
std::function<void (ResultOrError<std::vector<Face>>)> callback)
Detects the faces on an image with a callback API.
Note: The given ImageHeader doesn't own the image data, and it is safe to delete the data after the call, a copy is happening internally. See fvl::ImageHeader for details.
Note: Calling this function is non-blocking, so calling it again with the next frame without waiting for the result is possible. Also see getConcurrentCalculations().
Note: This is the callback based API, for std::future API see fvl::FaceVerifier::detectFaces(const fvl::ImageHeader&).
Parameters:
imageHeader- image descriptorcallback- callback to call with the result
Returns: tracked landmarks and emotions
std::future<std::vector<float>> embedFace(const fvl::Face& face)
Returns the embedding of the detected face.
Note: Calling this function is non-blocking, so calling it again with the next frame without waiting for the result is possible. Also see getConcurrentCalculations().
Note: This is the std::future based API, for callback API see fvl::FaceVerifier::embedFace(const fvl::Face&, std::function<void (ResultOrError<std::vector<float>>)>).
Parameters:
face- the previously detected face to embed
Returns: face embedding vector
void embedFace(const fvl::Face& face,
std::function<void (ResultOrError<std::vector<float>>)> callback)
Returns the embedding of the detected face.
Note: Calling this function is non-blocking, so calling it again with the next frame without waiting for the result is possible. Also see getConcurrentCalculations().
Note: This is the callback based API, for std::future API see fvl::FaceVerifier::embedFace(const fvl::Face&).
Parameters:
face- the previously detected face to embedcallback- callback to call with the result
fvl::Match compareFaces(const std::vector<float>& embedding1,
const std::vector<float>& embedding2)
Compares two embeddings
Parameters:
embedding1- embedding of one of the faces to compareembedding2- embedding of the other face to compare
Returns: match object with the similarity metric
int getConcurrentCalculations() const
Returns the value of the atomic counter for the number of calculations currently running concurrently. You can use this to limit the number of concurrent calculations.
Returns: The (approximate) number of calculations currently in-flight.
std::string getModelName() const
Returns the name (version etc) of the loaded model.
Returns: name of the model
static fvl::Version getSDKVersion()
Returns the version of the SDK (and not the model)
Returns: version of the SDK
static std::string getSDKVersionString()
Returns the version string of the SDK (and not the model)
Returns: version string of the SDK
#
Image header class
#
struct fvl::ImageHeader
Descriptor class for image data (non-owning)
Members:
const uint8_t* data- pointer to the byte array of the imageint width- width of the image in pixelsint height- height of the image in pixelsint stride- length of one row of pixels in bytes (e.g: 3*width + padding)fvl::ImageFormat format- image format
#
enum class fvl::ImageFormat
Values:
Grayscale = 0- 8-bit grayscaleRGB = 1- 24-bit RGBRGBA = 2- 32-bit RGBA or 32-bit RGB_BGR = 3- 24-bit BGRBGRA = 4- 32-bit BGRA or 32-bit BGR_
#
Result classes
#
Face
See also: landmarks specification.
#
class fvl::Face
Face Class
#
Constructors
Face(const fvl::ImageHeader& imageHeader,
const std::vector<fvl::Point2d>& landmarks,
const fvl::BoundingBox& bbox = fvl::BoundingBox(),
float confidence = 0.0f)
Constructor for the Face object to support 3rd party face detectors
Parameters:
imageHeader- image descriptorlandmarks- face landmarksbbox- face bounding boxconfidence- face detection confidence
~Face()
Destructor
#
Methods
DetectionQuality detectionQuality() const
Returns the detection quality of the detected face
Returns: DetectionQuality
BoundingBox boundingBox() const
Returns the bounding box of the detected face
Returns: BoundingBox
float confidence() const
Returns the confidence value of the detected face
Returns: float
std::vector<fvl::Point2d> landmarks() const
Returns the landmarks of the face
Returns: std::vectorfvl::Point2d
#
Point2d
#
struct fvl::Point2d
Point2d class for landmarks
Members:
float x- x coordinate of the pointfloat y- y coordinate of the point
#
BoundingBox
#
struct fvl::BoundingBox
Bounding Box class for the faces
Members:
int x- x coordinate of the top-left cornerint y- y coordinate of the top-left cornerint width- width of the bounding box in pixelsint height- height of the bounding box in pixels
#
Match
#
struct fvl::Match
Face match class
Members:
float similarity- similarity of the faces