computeAge method

int computeAge(
  1. Image image,
  2. DetectedFace detectedFace
)

Computes the age of a detected face. Important: Loading the FaceAgeEstimator model is required to use this function.

param image Source image to process. param detectedFace Detected face to process. return The estimated age of the detected face. throws FaceException An error has occurred during Face Library execution.

Implementation

int computeAge(Image image, DetectedFace detectedFace) {
  Pointer<Int> pAge = calloc();
  try {
    var err = faceSDK.id3FaceAnalyser_ComputeAge(_pHandle.value, image.handle, detectedFace.handle, pAge);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
    final vAge = pAge.value;
    return vAge;
  } finally {
    calloc.free(pAge);
  }
}