C++ API Documentation¶
Estimator class¶
-
class
DemographicEstimator
¶ The Demographic Estimator class.
Public Functions
-
DemographicEstimator
(const std::string &modelFile, int maxConcurrency = 0)¶ Constructor: loads model file, sets up the processing.
- Parameters
modelFile
: path for the used modelmaxConcurrency
: maximum allowed concurrency, 0 means automatic (using all cores), default: 0
-
~DemographicEstimator
()¶ Destructor.
-
std::future<std::vector<del::Face>>
detectFaces
(const del::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 del::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 del::DemographicEstimator::detectFaces(const del::ImageHeader&, std::function<void (ResultOrError<std::vector<Face>>)>).
- Parameters
imageHeader
: image descriptor
-
void
detectFaces
(const del::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 del::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 del::DemographicEstimator::detectFaces(const del::ImageHeader&).
- Return
tracked landmarks and emotions
- Parameters
imageHeader
: image descriptorcallback
: callback to call with the result
-
std::future<std::vector<del::Output>>
estimate
(const del::Face &face)¶ Returns the demographic estimation 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 del::DemographicEstimator::estimate(const del::Face&, std::function<void (ResultOrError<std::vector<del::Output>>)>).
- Return
estimations
- Parameters
face
: the previously detected face to embed
-
void
estimate
(const del::Face &face, std::function<void(ResultOrError<std::vector<del::Output>>)> callback)¶ Returns the demographic estimation 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 del::DemographicEstimator::estimate(const del::Face&).
- Parameters
face
: the previously detected face to embedcallback
: callback to call with the result
-
std::future<std::vector<del::Output>>
verify_under
(const del::Face &face, float age)¶ Returns the demographic estimation of the detected face with age verification.
- 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 del::DemographicEstimator::estimate(const del::Face&, std::function<void (ResultOrError<std::vector<del::Output>>)>).
- Return
estimations
- Parameters
face
: the previously detected face to embedage
: the age threshold
-
void
verify_under
(const del::Face &face, float age, std::function<void(ResultOrError<std::vector<del::Output>>)> callback)¶ Returns the demographic estimation of the detected face with age verification.
- 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 del::DemographicEstimator::estimate(const del::Face&).
- Parameters
face
: the previously detected face to embedage
: the age thresholdcallback
: callback to call with the result
-
std::future<std::vector<del::Output>>
verify_over
(const del::Face &face, float age)¶ Returns the demographic estimation of the detected face with age verification.
- 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 del::DemographicEstimator::estimate(const del::Face&, std::function<void (ResultOrError<std::vector<del::Output>>)>).
- Return
estimations
- Parameters
face
: the previously detected face to embedage
: the age threshold
-
void
verify_over
(const del::Face &face, float age, std::function<void(ResultOrError<std::vector<del::Output>>)> callback)¶ Returns the demographic estimation of the detected face with age verification.
- 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 del::DemographicEstimator::estimate(const del::Face&).
- Parameters
face
: the previously detected face to embedage
: the age thresholdcallback
: callback to call with the result
-
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.
- Return
The (approximate) number of calculations currently in-flight.
-
std::string
getModelName
() const¶ Returns the name (version etc) of the loaded model.
- Return
name of the model
-
Image header class¶
-
struct
ImageHeader
¶ Descriptor class for image data (non-owning)
Result classes¶
Face¶
See also: landmarks specification.
-
class
Face
¶ Face Class.
Public Functions
-
Face
(const del::ImageHeader &imageHeader, const std::vector<del::Point2d> &landmarks, const del::BoundingBox &bbox = del::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.
-
BoundingBox
boundingBox
() const¶ Returns the bounding box of the detected face.
- Return
-
float
confidence
() const¶ Returns the confidence value of the detected face.
- Return
float
-
Point2d¶
BoundingBox¶
-
struct
BoundingBox
¶ Bounding Box class for the faces.