getFaceEmbeddingFromMat method

Future<Float32List> getFaceEmbeddingFromMat(
  1. Face face,
  2. Mat image
)

Generates a face embedding from a pre-decoded cv.Mat image.

The Mat is NOT disposed by this method - caller is responsible for disposal.

Example:

final mat = cv.imdecode(imageBytes, cv.IMREAD_COLOR);
final faces = await detector.detectFacesFromMat(mat);
final embedding = await detector.getFaceEmbeddingFromMat(faces.first, mat);
mat.dispose();

Implementation

Future<Float32List> getFaceEmbeddingFromMat(Face face, cv.Mat image) {
  _requireReady();
  final f = _extractMatFields(image);
  return getFaceEmbeddingFromMatBytes(
    face,
    f.data,
    width: f.width,
    height: f.height,
    matType: f.matType,
  );
}