From eaa0fb02a69cc65ffc098b42b73c4b9b84eb884c Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Wed, 3 Jan 2024 11:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=A43399=E8=AE=BE=E5=A4=87=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=89=B2=E6=95=A3=E7=AE=97=E6=B3=95=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner.cpp | 6 ++++++ hgdriver/hgdev/image_process.cpp | 24 ++++++++++++++++++++++++ hgdriver/hgdev/image_process.h | 1 + 3 files changed, 31 insertions(+) diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index 74691c5..8b29916 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -5284,6 +5284,12 @@ bool hg_scanner::image_process(std::shared_ptr& buffer, uint32_t id (this->*dump_img_)(ImagePrc_pHandle_, "auto_crop"); } + if (pid_ != 0x239 && pid_ != 0x439 && image_prc_param_.bits.color_mode == COLOR_MODE_24_BITS) + { + ret = hg_imgproc::dispersion(ImagePrc_pHandle_); + (this->*dump_img_)(ImagePrc_pHandle_, "dispersion"); + } + if (is_quality_ == IMG_SPEED && resolution_ >= 300)//239 { VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "set resolution_ is :%d\n", resolution_) diff --git a/hgdriver/hgdev/image_process.cpp b/hgdriver/hgdev/image_process.cpp index cd9b7ff..97aa562 100644 --- a/hgdriver/hgdev/image_process.cpp +++ b/hgdriver/hgdev/image_process.cpp @@ -854,6 +854,26 @@ namespace hg_imgproc } return SCANNER_ERR_OK; } + int dispersion() + { + int ret = SCANNER_ERR_OK; + std::vector mats(mats_); + mats_.clear(); + + CImageApplyDispersion disp; + + for (int i = 0; i < mats.size(); ++i) + { + disp.apply(mats[i], 0); + mats_.push_back(mats[i]); + } + + if (mats_.empty()) + { + return SCANNER_ERR_NO_DATA; + } + return SCANNER_ERR_OK; + } int fillhole(float top,float low,float l,float r) { int ret = SCANNER_ERR_OK; @@ -1989,6 +2009,10 @@ namespace hg_imgproc { return ((imgproc*)himg)->auto_crop(dpi); } + int dispersion(HIMGPRC himg) + { + return ((imgproc*)himg)->dispersion(); + } int fillhole(HIMGPRC himg, float top, float low, float l, float r) { return ((imgproc*)himg)->fillhole(top, low, l,r); diff --git a/hgdriver/hgdev/image_process.h b/hgdriver/hgdev/image_process.h index e1320fc..cd9791d 100644 --- a/hgdriver/hgdev/image_process.h +++ b/hgdriver/hgdev/image_process.h @@ -186,6 +186,7 @@ namespace hg_imgproc int multi_out_red(HIMGPRC himg); int auto_matic_color(HIMGPRC himg,int color_type); int auto_crop(HIMGPRC himg, float dpi); + int dispersion(HIMGPRC himg); int fillhole(HIMGPRC himg, float top, float low, float r, float l); int resolution_change(HIMGPRC himg,float dpi3288); int croprect(HIMGPRC himg);