diff options
author | Melody Horn <melody@boringcactus.com> | 2021-12-05 21:31:26 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-12-05 21:31:26 -0700 |
commit | 62c60723a77e9d3b984f94924194b1a0ba753916 (patch) | |
tree | 91b95595576e144bebf6164d38ee0e4d6fe0f559 /src/ocr.rs | |
parent | fffdc8aab1086eb60bc9537fafb725ba876c46f2 (diff) | |
download | queue-go-brrr-62c60723a77e9d3b984f94924194b1a0ba753916.tar.gz queue-go-brrr-62c60723a77e9d3b984f94924194b1a0ba753916.zip |
recognize connection errors too
Diffstat (limited to 'src/ocr.rs')
-rw-r--r-- | src/ocr.rs | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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)) }) |