computeExpression method

FaceExpression computeExpression(
  1. Image image,
  2. DetectedFace detectedFace
)

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

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

Implementation

FaceExpression computeExpression(Image image, DetectedFace detectedFace) {
  Pointer<Int32> pExpression = calloc();
  try {
    var err = faceSDK.id3FaceAnalyser_ComputeExpression(_pHandle.value, image.handle, detectedFace.handle, pExpression);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
    final vExpression = FaceExpressionX.fromValue(pExpression.value);
    return vExpression;
  } finally {
    calloc.free(pExpression);
  }
}