Skip to main content

OcrEngine

Trait OcrEngine 

Source
pub trait OcrEngine: Send + Sync {
    // Required methods
    fn recognize(
        &self,
        image_data: &[u8],
        width: u32,
        height: u32,
        dpi: u32,
    ) -> Result<OcrPageResult, String>;
    fn supported_languages(&self) -> Vec<String>;
}
Expand description

Trait for pluggable OCR engines.

Implementors provide character recognition on rasterized page images.

Required Methods§

Source

fn recognize( &self, image_data: &[u8], width: u32, height: u32, dpi: u32, ) -> Result<OcrPageResult, String>

Recognize text in an image.

§Arguments
  • image_data - Raw pixel data (RGB, row-major).
  • width - Image width in pixels.
  • height - Image height in pixels.
  • dpi - Resolution in dots per inch.
Source

fn supported_languages(&self) -> Vec<String>

Return the list of supported languages.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§