OcrImage class

A decoded RGBA raster in plain Dart memory - the form the OCR pipeline works in, so all of its geometry/cropping/resizing is pure Dart and unit testable off a GPU.

Pixels are row-major, 4 bytes (R, G, B, A) each, top-left origin, y down - the same convention as ui.Image.toByteData(rawRgba) and an OCR model's pixel boxes.

Constructors

OcrImage({required Uint8List rgba, required int width, required int height})

Properties

hashCode → int
The hash code for this object.
no setterinherited
height → int
final
rgba → Uint8List
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
width → int
final

Methods

crop(Rect rect) → OcrImage
A copy of the sub-rectangle rect (clamped to the image bounds).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pixel(int x, int y) → ({int b, int g, int r})
The RGB value at integer pixel x, y (clamped to the image).
resize(int newWidth, int newHeight) → OcrImage
A bilinearly-resampled copy at newWidth x newHeight.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromUiImage(Image image) → Future<OcrImage>
Reads a page raster off the GPU into an OcrImage.