detectFromCameraFrame method
Detects hands directly from a CameraFrame produced by prepareCameraFrame.
The frame's YUV→BGR colour conversion and any optional rotation happen
inside the detection isolate, not on the calling thread. Use this from a
CameraController.startImageStream callback to keep the UI thread free
of OpenCV work.
Throws StateError if called before initialize.
Implementation
Future<List<Hand>> detectFromCameraFrame(
CameraFrame frame, {
int? maxDim,
}) async {
if (!isReady) {
throw StateError(
'HandDetector not initialized. Call initialize() first.');
}
final List<dynamic> result = await _worker!.sendRequest<List<dynamic>>(
'detectCameraFrame',
cameraFrameRpcFields(frame, {'maxDim': maxDim}),
);
return _deserializeHands(result);
}