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 6d90b82..f0061bf 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);