Skip to main content

load_image

Function load_image 

Source
pub fn load_image<P>(path: P) -> Result<ImageBuffer<Rgb<u8>, Vec<u8>>, OCRError>
where P: AsRef<Path>,
Expand description

Loads an image from a file path and converts it to RgbImage.

This function opens an image from the specified file path and converts it to an RgbImage. It handles any image format supported by the image crate.

§Arguments

  • path - A reference to the path of the image file to load

§Returns

  • Ok(RgbImage) - The loaded and converted RGB image
  • Err(OCRError) - An error if the image could not be loaded or converted

§Errors

This function will return an OCRError::ImageLoad error if the image cannot be loaded from the specified path, or if there is an error during conversion.