convertCameraImageToBytes static method
Converts a CameraImage
in YUV420 format to Image
in RGB format
Implementation
static Future<Uint8List?> convertCameraImageToBytes(
CameraImage cameraImage) async {
ImageUtilsIsolate.init();
return (await ImageUtilsIsolate.converterFromCameraToBytesIsolate.compute([
cameraImage.format.group,
cameraImage.planes[1].bytesPerRow,
cameraImage.planes[1].bytesPerPixel ?? 0,
cameraImage.planes.map((e) => e.bytes).toList(),
cameraImage.width,
cameraImage.height
]) as TransferableTypedData?)?.materialize().asUint8List();
}