getFaceAttribute method

Future<List<double>> getFaceAttribute(
  1. CameraImage image,
  2. bool isExpression
)

Implementation

Future<List<double>> getFaceAttribute(
    CameraImage image, bool isExpression) async {
  List<int> strides = Int32List(image.planes.length * 2);
  int index = 0;
  final bytes = image.planes.map((plane) {
    strides[index] = (plane.bytesPerRow);
    index++;
    strides[index] = (plane.bytesPerPixel)!;
    index++;
    return plane.bytes;
  }).toList();

  var data = await platform.invokeMethod<List<double>>("getFaceAttribute", {
    'platforms': bytes,
    'height': image.height,
    'width': image.width,
    'strides': strides,
    'isExpression': isExpression
  });

  if (data == null) {
    return [];
  }

  return data;
}