diff --git a/src/lib.rs b/src/lib.rs index b1c0fa7..13dbb2c 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,7 +69,7 @@ pub fn run(opt: &Opt) -> anyhow::Result<()> { .unzip() }; - let images_for_ocr = preprocessor::process_images_for_ocr(idx, images, opt.border)?; + let images_for_ocr = preprocessor::process_images_for_ocr(idx, images, opt.border); // Dump images if requested. if opt.dump { diff --git a/src/preprocessor.rs b/src/preprocessor.rs index b6d607a..097f98a 100644 --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -3,16 +3,11 @@ use rayon::prelude::*; use subtile::{ image::{ToOcrImage, ToOcrImageOpt}, vobsub::{self, VobSubIndexedImage, VobSubOcrImage}, - SubtileError, }; /// Return a vector of processed images for OCR. #[profiling::function] -pub fn process_images_for_ocr( - idx: vobsub::Index, - images: I, - border: u32, -) -> Result, SubtileError> +pub fn process_images_for_ocr(idx: vobsub::Index, images: I, border: u32) -> Vec where I: IntoParallelIterator, { @@ -21,14 +16,13 @@ where ..Default::default() }; let palette = rgb_palette_to_luminance(idx.palette()); - let result = images + images .into_par_iter() .map(|vobsub_img| { let converter = VobSubOcrImage::new(&vobsub_img, &palette); converter.image(&opt) }) - .collect(); - Ok(result) + .collect() } /// Convert an sRGB palette to a luminance palette.