detectFacesWithSegmentationFromMat method

Future<DetectionWithSegmentationResult> detectFacesWithSegmentationFromMat(
  1. Mat image, {
  2. FaceDetectionMode mode = FaceDetectionMode.full,
  3. IsolateOutputFormat outputFormat = IsolateOutputFormat.float32,
  4. double binaryThreshold = 0.5,
})

Detects faces and generates segmentation mask in parallel from a cv.Mat.

The original Mat is NOT disposed by this method.

Implementation

Future<DetectionWithSegmentationResult> detectFacesWithSegmentationFromMat(
  cv.Mat image, {
  FaceDetectionMode mode = FaceDetectionMode.full,
  IsolateOutputFormat outputFormat = IsolateOutputFormat.float32,
  double binaryThreshold = 0.5,
}) {
  _requireReady();
  _requireSegmentationReady();
  final f = _extractMatFields(image);
  return _detectAndSegmentImpl(
    detectOp: 'detectMat',
    detectFields: {
      'bytes': TransferableTypedData.fromList([f.data]),
      'width': f.width,
      'height': f.height,
      'matType': f.matType,
      'mode': mode.name,
    },
    segmentOp: 'segmentMat',
    segmentFields: {
      'bytes': TransferableTypedData.fromList([f.data]),
      'width': f.width,
      'height': f.height,
      'matType': f.matType,
      'outputFormat': outputFormat.index,
      'binaryThreshold': binaryThreshold,
    },
  );
}