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").

Implementors§