Preprocessor

Trait Preprocessor 

Source
pub trait Preprocessor:
    Send
    + Sync
    + Debug {
    type Config: Send + Sync + Debug;
    type Output: Send + Sync + Debug;

    // Required method
    fn preprocess(
        &self,
        images: Vec<RgbImage>,
        config: Option<&Self::Config>,
    ) -> Result<Self::Output, OCRError>;

    // Provided methods
    fn preprocessing_info(&self) -> String { ... }
    fn validate_input(&self, images: &[RgbImage]) -> Result<(), OCRError> { ... }
}
Expand description

Trait for image preprocessing operations.

This trait handles transforming raw images into the format required by the inference engine (resizing, normalization, tensor conversion, etc.).

Required Associated Types§

Source

type Config: Send + Sync + Debug

Configuration type for preprocessing

Source

type Output: Send + Sync + Debug

Output type after preprocessing

Required Methods§

Source

fn preprocess( &self, images: Vec<RgbImage>, config: Option<&Self::Config>, ) -> Result<Self::Output, OCRError>

Preprocess input images into inference-ready format.

§Arguments
  • images - Input images to preprocess
  • config - Optional configuration for preprocessing
§Returns

Preprocessed output ready for inference or an error

Provided Methods§

Source

fn preprocessing_info(&self) -> String

Get information about the preprocessing requirements.

§Returns

String describing preprocessing requirements (input size, format, etc.)

Source

fn validate_input(&self, images: &[RgbImage]) -> Result<(), OCRError>

Validate that the input images are suitable for preprocessing.

§Arguments
  • images - Input images to validate
§Returns

Result indicating success or validation error

Implementors§