detectBodyMask static method

Future<BodyMask?> detectBodyMask({
  1. required PngImage image,
})

Implementation

static Future<BodyMask?> detectBodyMask({required PngImage image}) async {
  final Uint8List pngImageBytes = image.bytes.buffer.asUint8List();
  try {
    final result = await _channel.invokeMapMethod(
      'detectImageSegmentationMask',
      <String, dynamic>{
        'pngImageBytes': pngImageBytes,
      },
    );
    return result == null ? null : BodyMask.fromMap(result);
  } on PlatformException catch (e) {
    throw BodyDetectionException(e.code, e.message);
  }
}