Skip to main content

Module ocr

Module ocr 

Source
Expand description

OCR backend trait and implementations.

§OCR Backend Extension

The OcrBackend trait is public. Callers can implement their own backends for specific use cases:

  • ocrs (this crate, ocr feature): pure-Rust Tesseract-style engine. WASM-compatible. Requires external model files (.rten format).

  • Mistral OCR (ocr-mistral feature): blocking HTTP adapter to Mistral’s cloud OCR API.

  • Google Vision (ocr-google feature): blocking HTTP adapter to Google Cloud Vision’s images:annotate OCR endpoint.

  • AWS Textract (ocr-aws feature): blocking HTTP adapter to Amazon Textract’s DetectDocumentText endpoint.

  • Azure Document Intelligence (ocr-azure feature): blocking HTTP adapter to the prebuilt-read model.

  • Paddle ONNX (ocr-onnx feature): adapter around pdf-ocr’s PaddleOCR engine.

  • Custom: implement OcrBackend directly for proprietary or cloud-based OCR flows.

Structs§

OcrResult
Result of recognizing text in a single image.
OcrWord
A single recognized word.

Enums§

OcrError
Errors returned by an OcrBackend.

Traits§

OcrBackend
Pluggable OCR backend.

Functions§

best_available_backend
Return the first available OCR backend in priority order.