From 8b553405402c292e9d11a945bb8a35265e57bce0 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Mon, 12 Sep 2022 12:57:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A9=BF=E5=AD=94=E7=A7=BB?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner.cpp | 10 +++++++- hgdriver/hgdev/hg_scanner_239.cpp | 40 +++++++++++++++---------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index bfff613..da779e1 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -2356,6 +2356,7 @@ int hg_scanner::save_final_image(hg_imgproc::LPIMGHEAD head, void* buf) } void hg_scanner::adjust_filling_hole(LPSCANCONF conf) { + int maxval = 0; #define SET_FILL_HOLE(member, me) \ conf->fillholeratio_##member = isremove_##me##_hole ? isremove_##me##_hole_threshold * 100 + .5f : 0; \ @@ -2370,7 +2371,14 @@ void hg_scanner::adjust_filling_hole(LPSCANCONF conf) SET_FILL_HOLE(down, low); SET_FILL_HOLE(left, left); SET_FILL_HOLE(right, right); - + if (!isremove_left_hole) + conf->fillholeratio_left = 0; + if (!isremove_right_hole) + conf->fillholeratio_right = 0; + if (!isremove_top_hole) + conf->fillholeratio_up = 0; + if (!isremove_low_hole) + conf->fillholeratio_down = 0; if (maxval) { conf->fillhole.is_fillhole = true; diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index 7d43b7f..a08ec08 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -682,26 +682,8 @@ void hg_scanner_239::image_process(std::shared_ptr& buff) err = hg_imgproc::load_buffer(handle, buff); err = hg_imgproc::decode(handle,pid_); - if (!isremove_left_hole) - { - isremove_top_hole_threshold = 0; - } - if (!isremove_right_hole) - { - isremove_right_hole_threshold = 0; - } - if (!isremove_top_hole) - { - isremove_top_hole_threshold = 0; - } - if (!isremove_low_hole) - { - isremove_low_hole_threshold = 0; - } - if (isremove_left_hole || isremove_right_hole || isremove_top_hole || isremove_low_hole) - { - err = hg_imgproc::fillhole(handle, isremove_top_hole_threshold, isremove_low_hole_threshold, isremove_left_hole_threshold, isremove_right_hole_threshold); - } + + if(image_prc_param_.bits.erase_bakground) { err = hg_imgproc::fadeback(handle,img_conf_.fadebackrange,img_conf_.is_duplex); @@ -926,7 +908,6 @@ int hg_scanner_239::writedown_image_configuration(void) ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用 ic.fillhole.is_fillhole = image_prc_param_.bits.rid_hole; ic.fillhole.fillholeratio = rid_hole_range_; - adjust_filling_hole(&ic); ic.detachnoise.is_detachnoise = image_prc_param_.bits.noise_optimize; ic.detachnoise.detachnoise = noise_range_; ic.is_autotext = image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO ? 1 :0; @@ -952,6 +933,23 @@ int hg_scanner_239::writedown_image_configuration(void) ic.fadeback = image_prc_param_.bits.erase_bakground; ic.fadebackrange = erase_bkg_range_; ic.isuoloadexceptionimage = (double_paper_handle_ & DOUBLE_PAPER_SAVE_IMG) == DOUBLE_PAPER_SAVE_IMG; + adjust_filling_hole(&ic); + if (!isremove_left_hole) + { + ic.fillholeratio_left = 0; + } + if (!isremove_right_hole) + { + ic.fillholeratio_right = 0; + } + if (!isremove_top_hole) + { + ic.fillholeratio_up = 0; + } + if (!isremove_low_hole) + { + ic.fillholeratio_down = 0; + } int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 }; if(image_prc_param_.bits.color_mode == COLOR_MODE_24_BITS || image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH)