1 to 1 Face Recognition¶
-
ErrorCode Trueface::SDK::getFaceFeatureVector(const TFImage &tfImage, const FaceBoxAndLandmarks &faceBoxAndLandmarks, Faceprint &faceprint)¶
Extract the face feature vector (Faceprint) from the face box.
- Parameters
tfImage – [in] the input image returned by preprocessImage().
faceBoxAndLandmarks – [in] the FaceBoxAndLandmarks returned by detectFaces() or detectLargestFace().
faceprint – [out] Faceprint to contain the face template.
- Returns
error code, see ErrorCode.
-
ErrorCode Trueface::SDK::getFaceFeatureVector(const TFFacechip &tfFacechip, Faceprint &faceprint)¶
Extract the face feature vector (Faceprint) from an aligned face chip.
- Parameters
tfImage – [in] the input image returned by preprocessImage().
tfFacechip – [in] TFFacechip returned by extractAlignedFace(). Face image must be have size of 112x112 pixels (default extractAlignedFace() margin and scale values).
faceprint – [out] a Faceprint object which will contain the face feature vector.
- Returns
error code, see ErrorCode.
-
ErrorCode Trueface::SDK::getFaceFeatureVectors(const std::vector<TFFacechip> &tfFacechips, std::vector<Faceprint> &faceprints)¶
Extract the face feature vectors (Faceprints) from the face chips. This batch processing method increases throughput when using GPU inference.
- Parameters
tfFacechips – [in] vector of TFFacechip.
faceprints – [out] vector of Faceprint object which will contain the face feature vectors.
- Returns
error code, see ErrorCode.
-
ErrorCode Trueface::SDK::getLargestFaceFeatureVector(const TFImage &tfImage, Faceprint &faceprint, bool &foundFace)¶
Detect the largest face in the image by area and return its feature vector (Faceprint).
- Parameters
tfImage – [in] the input image returned by preprocessImage().
faceprint – [out] a Faceprint object which will contain the face feature vector.
foundFace – [out] indicates if a face was detected in the image. If no face was detected, then the faceprint will be empty.
- Returns
error code, see ErrorCode.
-
static std::string Trueface::SDK::faceprintToJson(const Faceprint &faceprint)¶
Convert a Faceprint into a json string.
-
static ErrorCode Trueface::SDK::jsonToFaceprint(const std::string &jsonStr, Faceprint &faceprint)¶
Populate a Faceprint from a json string.
- Parameters
jsonStr – [in] The json string representation of a Faceprint, generated from the faceprintToJson() function.
faceprint – [out] The Faceprint which will be populated from the json string.
- Returns
error code, see ErrorCode.
-
static ErrorCode Trueface::SDK::getSimilarity(const Faceprint &faceprint1, const Faceprint &faceprint2, float &matchProbability, float &similarityMeasure)¶
Compute the similarity between two feature vectors, or how similar two faces are. Note, while the matchProbability may be more intuitive to understand, match thresholding should be performed on the similarityMeasure. To understand the difference between these two metrics, refer to our FAQ page. Refer to our ROC curves when selecting a threshold.
-
struct Trueface::Faceprint¶
Face feature vector and meta data.
Public Members
-
std::vector<float> featureVector¶
Vector of floats which describe the face.
-
std::string modelName¶
Name of model used to generate feature vector.
-
ModelOptions modelOptions¶
Additional options used when generating the feature vector.
-
std::vector<float> featureVector¶
-
struct Trueface::ModelOptions¶
Options used when generating the feature vector.
Public Members
-
bool frVectorCompression = false¶
Indicates if the
Trueface::ConfigurationOptions.frVectorCompression
was enabled when generating the template.
-
bool frVectorCompression = false¶