1 to 1 Face Recognition

ErrorCode Trueface::SDK::getFaceFeatureVector(const TFImage &tfImage, const FaceBoxAndLandmarks &faceBoxAndLandmarks, Faceprint &faceprint)

Extract the face feature vector from the face box.

Parameters
Returns

error code, see ErrorCode.

ErrorCode Trueface::SDK::getFaceFeatureVector(const TFFacechip &tfFacechip, Faceprint &faceprint)

Extract the face feature vector from an aligned face chip.

Parameters
Returns

error code, see ErrorCode.

ErrorCode Trueface::SDK::getFaceFeatureVectors(const std::vector<TFFacechip> &tfFacechips, std::vector<Faceprint> &faceprints)

Extract the face feature vectors 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 and return its feature vector.

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.

Parameters

faceprint[in] The Faceprint to stringify.

Returns

The json string representation of the Faceprint.

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.

See

getLargestFaceFeatureVector

Parameters
  • faceprint1[in] the first Faceprint to be compared.

  • faceprint2[in] the second Faceprint to be compared.

  • matchProbability[out] the probability the two face feature vectors are a match.

  • similarityMeasure[out] the computed similarity measure.

Returns

error code, see ErrorCode.

ErrorCode Trueface::SDK::estimateFaceImageQuality(const TFFacechip &tfFacechip, float &quality)

Estimate the quality of the face image for recognition.

Parameters
  • tfFacechip[in] The TFFacechip returned by extractAlignedFace().

  • quality[out] a value between 0 to 1, 1 being prefect quality for recognition. We suggest using a threshold of 0.999 as a filter for enrollment images.

Returns

error code, see ErrorCode.

struct Trueface::Faceprint

Face feature vector and meta data.

Public Members

std::vector<float> featureVector

Vector of floats which describe the face.

std::string sdkVersion

SDK version used to generate feature vector.

std::string modelName

Name of model used to generate feature vector.

ModelOptions modelOptions

Additional options used when generating the feature vector.

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.