Skip to main content

load_images_batch_with_threshold

Function load_images_batch_with_threshold 

Source
pub fn load_images_batch_with_threshold<P>(
    paths: &[P],
    parallel_threshold: Option<usize>,
) -> Result<Vec<ImageBuffer<Rgb<u8>, Vec<u8>>>, OCRError>
where P: AsRef<Path> + Send + Sync,
Expand description

Loads a batch of images from file paths with a custom parallel threshold.

This function loads multiple images from the specified file paths and converts them to RgbImages. It uses parallel processing when the number of images exceeds the specified threshold, or the default threshold if none is provided.

§Arguments

  • paths - A slice of paths to the image files to load
  • parallel_threshold - An optional threshold for parallel processing. If None, the default threshold from DEFAULT_PARALLEL_THRESHOLD is used.

§Returns

  • Ok(Vec<RgbImage>) - A vector of loaded RGB images
  • Err(OCRError) - An error if any image could not be loaded

§Errors

This function will return an OCRError if any image cannot be loaded from its specified path.