recognizeBuffer method

  1. @override
Future<List<List<OcrLine>>?> recognizeBuffer(
  1. Uint8List bytes,
  2. int width,
  3. int height,
  4. int stride,
  5. int format,
  6. int rotation,
)
override

Performs OCR on an image buffer.

Parameters:

  • bytes: Raw image data (RGBA).
  • width: Image width in pixels.
  • height: Image height in pixels.
  • stride: Number of bytes per row.
  • format: Pixel format index (e.g., ImagePixelFormat.IPF_ARGB_8888.index).
  • rotation: Rotation angle in degrees (0, 90, 180, 270).

Returns a list of OCR results, where each item is a list of OcrLine representing one text region (like MRZ or VIN blocks).

Implementation

@override
Future<List<List<OcrLine>>?> recognizeBuffer(Uint8List bytes, int width,
    int height, int stride, int format, int rotation) async {
  List<dynamic>? results =
      await methodChannel.invokeMethod('recognizeBuffer', {
    'bytes': bytes,
    'width': width,
    'height': height,
    'stride': stride,
    'format': format,
    'rotation': rotation
  });

  if (results == null || results.isEmpty) return [];

  return _resultWrapper(results);
}