cameraFrameFromRpcMessage function
Reconstructs a CameraFrame from an isolate-request message built by
cameraFrameRpcFields and the already-materialized bytes.
The pure-Dart counterpart of each detector's OpenCV decode: the
cameraFrameToBgrMat-style step that follows stays per-detector (they own
the opencv dependency), this only rebuilds the backend-neutral descriptor.
Implementation
CameraFrame cameraFrameFromRpcMessage(Map message, Uint8List bytes) {
final int? rotationIndex = message['rotation'] as int?;
return CameraFrame(
bytes: bytes,
width: message['width'] as int,
height: message['height'] as int,
strideCols: message['strideCols'] as int,
conversion: CameraFrameConversion.values[message['conversion'] as int],
rotation: rotationIndex == null
? null
: CameraFrameRotation.values[rotationIndex],
);
}