processImage method

Future<List<Face>> processImage(
  1. InputImage inputImage
)

Detects faces in the input image.

Implementation

Future<List<Face>> processImage(InputImage inputImage) async {
  _hasBeenOpened = true;

  final result = await Vision.channel.invokeListMethod<dynamic>(
      'vision#startFaceDetector', <String, dynamic>{
    'options': <String, dynamic>{
      'enableClassification': options.enableClassification,
      'enableLandmarks': options.enableLandmarks,
      'enableContours': options.enableContours,
      'enableTracking': options.enableTracking,
      'minFaceSize': options.minFaceSize,
      'mode': _enumToString(options.mode),
    },
    'imageData': inputImage._getImageData(),
  });

  final List<Face> faces = <Face>[];
  for (final dynamic data in result!) {
    faces.add(Face._(data));
  }

  return faces;
}