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:
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:
  • 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.

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. 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.

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.

struct 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 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.