Skip to main content

OcrBackend

Trait OcrBackend 

Source
pub trait OcrBackend: Send + Sync {
    // Required methods
    fn recognize(
        &self,
        image_data: &[u8],
        width: u32,
        height: u32,
    ) -> Result<OcrResult, OcrError>;
    fn name(&self) -> &str;
}
Expand description

Pluggable OCR backend.

Implementations receive raw RGB pixel data and return recognized text. Implementations must be Send + Sync so they can be held in a static or shared across threads.

Required Methods§

Source

fn recognize( &self, image_data: &[u8], width: u32, height: u32, ) -> Result<OcrResult, OcrError>

Recognize text in a rasterized page image.

§Arguments
  • image_data — raw RGB pixels, row-major, 3 bytes per pixel.
  • width — image width in pixels.
  • height — image height in pixels.
Source

fn name(&self) -> &str

Short identifier shown in test metadata (e.g. "ocrs", "mistral").

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl OcrBackend for AwsTextractBackend

Available on crate feature ocr-aws only.
Source§

impl OcrBackend for AzureDocIntelBackend

Available on crate feature ocr-azure only.
Source§

impl OcrBackend for GoogleVisionBackend

Available on crate feature ocr-google only.
Source§

impl OcrBackend for MistralOcrBackend

Available on crate feature ocr-mistral only.
Source§

impl OcrBackend for OcrsBackend

Available on crate feature ocr only.
Source§

impl OcrBackend for PaddleOnnxBackend

Available on crate feature ocr-onnx only.