toInputImage method

InputImage toInputImage(
  1. CameraDescription camera
)

Implementation

InputImage toInputImage(CameraDescription camera) {
  final inputImageData = InputImageData(
    size: Size(width.toDouble(), height.toDouble()),
    imageRotation:
        InputImageRotationValue.fromRawValue(camera.sensorOrientation) ??
            InputImageRotation.rotation0deg,
    inputImageFormat: InputImageFormatValue.fromRawValue(format.raw) ??
        InputImageFormat.nv21,
    planeData: planes
        .map((Plane plane) => InputImagePlaneMetadata(
              bytesPerRow: plane.bytesPerRow,
              height: plane.height,
              width: plane.width,
            ))
        .toList(),
  );
  return InputImage.fromBytes(
      bytes: getBytes(), inputImageData: inputImageData);
}