From b02208677da77ea7dbac799615a38144d9952cc6 Mon Sep 17 00:00:00 2001 From: Alex Ong Date: Fri, 14 Aug 2020 00:11:53 +1000 Subject: [PATCH] fix: Disable interlacing for all devices except OPENCV, since we need a perfect input to do our current method. --- nestris_ocr/calibration/auto_calibrate.py | 5 +++-- nestris_ocr/capturing/deinterlacer.py | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/nestris_ocr/calibration/auto_calibrate.py b/nestris_ocr/calibration/auto_calibrate.py index ed55144..d9d937b 100644 --- a/nestris_ocr/calibration/auto_calibrate.py +++ b/nestris_ocr/calibration/auto_calibrate.py @@ -18,9 +18,10 @@ def fix_interlace_resize(rect): def auto_calibrate_raw(config): + # todo: ask the capture method for screen size, and capture full screen. captureAreas = ( - (0, 0, 4000, 2000), # 4k screens fullscreen - (0, 0, 1500, 1500), # reasonably sized screens + (0, 0, 2000, 1000), # 4k screens fullscreen + (0, 0, 1000, 1000), # reasonably sized screens ) capture = uncached_capture() interlace_settings = get_mode_res() diff --git a/nestris_ocr/capturing/deinterlacer.py b/nestris_ocr/capturing/deinterlacer.py index 0b231c3..f7885b0 100644 --- a/nestris_ocr/capturing/deinterlacer.py +++ b/nestris_ocr/capturing/deinterlacer.py @@ -51,6 +51,10 @@ def from_string(cls, value): def get_mode_res(): mode = InterlaceMode.from_string(config["capture.deinterlace_method"]) res = InterlaceRes.from_string(config["capture.deinterlace_res"]) + # hack: we should do some business logic elsewhere to disable de-interlacing + # on devices that don't support it? + if config["capture.method"] != "OPENCV": + mode = InterlaceMode.NONE return mode, res