Skip to main content

Crate rightkit_ocr

Crate rightkit_ocr 

Source
Expand description

Product-neutral two-stage ONNX OCR pipeline.

Two-model pipeline:

  1. Det model (det.onnx) — DB detector; finds text bounding boxes in the image.
  2. Rec model (rec.onnx) — multilingual recognizer (50 languages + symbols + emoji, 18,708-char dict); reads text from each cropped box. The vocab length is read from the model output at runtime, so the dict is model-driven, not hardcoded.

The caller configures the dynamic runtime through rightkit-onnx, supplies an absolute model directory, and supplies resolved artifact provenance.

Re-exports§

pub use worker::RunRecord;
pub use worker::WorkerCommand;
pub use worker::WorkerEvent;
pub use worker::WorkerEvents;
pub use worker::WorkerFailure;
pub use worker::WorkerRun;

Modules§

worker
Isolated child-per-request native OCR worker (ViewRight ocr_worker.rs).

Structs§

Ocr
A reusable OCR handle. The ONNX engine loads lazily on first need and is then kept warm.
OcrArtifactManifest
OcrEngine
A loaded, warm OCR engine.
OcrLine
One recognized line with its position on the image.
OcrOptions
OcrOutcome
Newline-joined text and the backend that produced it (ScrapeRight’s OcrOutcome shape).
OcrRect
A normalized rectangle: 0..1 of the source image, origin top-left.
OcrResult
Text + geometry + confidence + provenance.
OnnxConfig
Verified ONNX model set used by the fallback / Onnx preference.
VerifiedOcrArtifacts

Enums§

BackendPreference
Isolation
Where native recognition runs.
OcrBackend
Which backend produced a result.
OcrError
OcrErrorKind
Typed classification of an OCR failure, so hosts key on a kind instead of message text.
OcrProvenance

Constants§

MACOS_VISION_UNAVAILABLE
Prefix for an Apple Vision request that could not be performed.
MAX_PIXELS
Largest image decoded, in pixels (enforced on the header, before any pixel buffer is allocated — a decompression-bomb guard).
OCR_UNSUPPORTED_PLATFORM
Prefix for a platform with no native OCR backend at all (Linux builds).
WINDOWS_OCR_UNAVAILABLE
Prefix for a Windows backend that cannot recognize at all (no language pack).

Traits§

ModelLeaseHook
An app’s model-store lease/refs registration, held for an ONNX engine’s lifetime.
NativeHealthHook
A host-maintained memory of the native backend’s health verdict (no cache lives in this crate).

Functions§

canary_png
Embedded known-text PNG for the separate-process health canary.
decode_encoded
Decode PNG/JPEG bytes to RGB with the MAX_PIXELS guard.
is_backend_unavailable
Does this error mean the native backend is unusable on this machine (a capability verdict, and the only thing that arms the ONNX fallback), as opposed to a per-image failure that must stay visible?
native_backend
The native backend for this OS, if compiled in (native feature) and supported.
ocr_image_with_manifest