getFaceEmbeddingFromMatBytes method

Future<Float32List> getFaceEmbeddingFromMatBytes(
  1. Face face,
  2. Uint8List bytes, {
  3. required int width,
  4. required int height,
  5. int matType = 16,
})

Generates a face embedding from raw pixel bytes without constructing a cv.Mat.

Mirrors detectFacesFromMatBytes - use this when you already have decoded pixel data to avoid the overhead of building a Mat on the calling thread.

Parameters:

  • bytes: Raw pixel data (e.g. BGR, BGRA)
  • width: Image width in pixels
  • height: Image height in pixels
  • matType: OpenCV MatType value (default: CV_8UC3 = 16 for BGR)

Implementation

Future<Float32List> getFaceEmbeddingFromMatBytes(
  Face face,
  Uint8List bytes, {
  required int width,
  required int height,
  int matType = 16,
}) async {
  _requireReady();
  final Object? result = await _sendDetectionRequest<Object?>(
    'embeddingMat',
    {
      'bytes': TransferableTypedData.fromList([bytes]),
      'width': width,
      'height': height,
      'matType': matType,
      'eyes': _embeddingEyesPayload(face),
    },
  );
  return result as Float32List;
}