detectHumanFromBytes method
Detect human from image bytes.
Implementation
@override
Future<HumanDetectionResult> detectHumanFromBytes(
Uint8List imageBytes,
) async {
try {
final result = await methodChannel.invokeMapMethod<dynamic, dynamic>(
'detectHumanFromBytes',
{'imageBytes': imageBytes},
);
if (result == null) {
throw const HumanDetectionException(
'Detection returned null result',
code: HumanDetectionErrorCode.inferenceFailed,
);
}
return HumanDetectionResult.fromMap(result);
} on PlatformException catch (e) {
throw HumanDetectionException(
e.message ?? 'Failed to detect human from bytes',
code: e.code,
details: e.details,
);
}
}