aboutsummaryrefslogtreecommitdiff
path: root/src/ocr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ocr.rs')
-rw-r--r--src/ocr.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ocr.rs b/src/ocr.rs
index 14021cc..52e0020 100644
--- a/src/ocr.rs
+++ b/src/ocr.rs
@@ -1,4 +1,4 @@
-use image::{DynamicImage, GrayImage, ImageFormat};
+use image::{GrayImage, ImageFormat};
use imageproc::template_matching::MatchTemplateMethod;
use lazy_static::lazy_static;
@@ -36,11 +36,10 @@ fn x_matches(image: &GrayImage, template: &GrayImage) -> Vec<u32> {
.collect()
}
-pub fn ocr(image: DynamicImage) -> Option<u32> {
- let grayscale_image = image::imageops::grayscale(&image);
+pub fn ocr(image: &GrayImage) -> Option<u32> {
let mut digit_x_positions: Vec<(u8, u32)> = (0..10)
.flat_map(|i| {
- x_matches(&grayscale_image, &REFERENCES[i as usize])
+ x_matches(image, &REFERENCES[i as usize])
.into_iter()
.map(move |x| (i, x))
})