toInputImage method
InputImage
toInputImage(
{ - int rotation = 0,
})
Implementation
InputImage toInputImage({int rotation = 0}) {
final WriteBuffer allBytes = WriteBuffer();
for (final Plane plane in this.planes) {
allBytes.putUint8List(plane.bytes);
}
final bytes = allBytes.done().buffer.asUint8List();
final Size imageSize = Size(this.width.toDouble(), this.height.toDouble());
final InputImageRotation imageRotation = InputImageRotationValue.fromRawValue(rotation)!;
final InputImageFormat inputImageFormat = InputImageFormatValue.fromRawValue(this.format.raw)!;
final metadata = InputImageMetadata(
size: imageSize,
rotation: imageRotation,
format: inputImageFormat,
bytesPerRow: planes.first.bytesPerRow,
);
return InputImage.fromBytes(
bytes: bytes,
metadata: metadata,
);
}