diff --git a/hgdriver/hgdev/hg_scanner_200.cpp b/hgdriver/hgdev/hg_scanner_200.cpp index 4e5b774..3a42282 100644 --- a/hgdriver/hgdev/hg_scanner_200.cpp +++ b/hgdriver/hgdev/hg_scanner_200.cpp @@ -628,7 +628,8 @@ void hg_scanner_200::image_process(std::shared_ptr>& buffer) //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n"); } /////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// - hg_imgproc::customgamma(handle,false); //临时false + int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); + hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength); if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) { diff --git a/hgdriver/hgdev/hg_scanner_300.cpp b/hgdriver/hgdev/hg_scanner_300.cpp index 647be58..563a5d1 100644 --- a/hgdriver/hgdev/hg_scanner_300.cpp +++ b/hgdriver/hgdev/hg_scanner_300.cpp @@ -364,7 +364,7 @@ void hg_scanner_300::thread_handle_usb_read(void) if (ret == HG_ERR_DEVICE_SLEEPING) { status_ = ret; - notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_SLEEPING, SANE_EVENT_SCAN_FINISHED, status_); + notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_); HG_VLOG_MINI_1(HG_LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_HG_ERR_DEVICE_SLEEPING); return ret; } @@ -372,7 +372,7 @@ void hg_scanner_300::thread_handle_usb_read(void) if (ret == HG_ERR_DEVICE_NO_PAPER) { status_ = ret; - notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_NO_PAPER, SANE_EVENT_SCAN_FINISHED, status_); + notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_); HG_VLOG_MINI_1(HG_LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_HG_ERR_DEVICE_NO_PAPER); return ret; } @@ -585,7 +585,8 @@ void hg_scanner_300::image_process(std::shared_ptr>& buffer) //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n"); } /////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// - hg_imgproc::customgamma(handle,false); //临时false + int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); + hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength); if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) { diff --git a/hgdriver/hgdev/hg_scanner_400.cpp b/hgdriver/hgdev/hg_scanner_400.cpp index ccf06b3..f105211 100644 --- a/hgdriver/hgdev/hg_scanner_400.cpp +++ b/hgdriver/hgdev/hg_scanner_400.cpp @@ -362,7 +362,7 @@ int hg_scanner_400::start(void) if (ret == HG_ERR_DEVICE_SLEEPING) { status_ = ret; - notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_SLEEPING, SANE_EVENT_SCAN_FINISHED, status_); + notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_); HG_VLOG_MINI_1(HG_LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_HG_ERR_DEVICE_SLEEPING); return ret; } @@ -370,7 +370,7 @@ int hg_scanner_400::start(void) if (ret == HG_ERR_DEVICE_NO_PAPER) { status_ = ret; - notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_NO_PAPER, SANE_EVENT_SCAN_FINISHED, status_); + notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_); HG_VLOG_MINI_1(HG_LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_HG_ERR_DEVICE_NO_PAPER); return ret; } @@ -588,7 +588,8 @@ void hg_scanner_400::image_process(std::shared_ptr>& buffer) //HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner::strerr((hg_err)ret).c_str()); } /////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// - hg_imgproc::customgamma(handle,false); //临时false + int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); + hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength); if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) { diff --git a/hgdriver/hgdev/image_process.cpp b/hgdriver/hgdev/image_process.cpp index 8983176..04ef7c0 100644 --- a/hgdriver/hgdev/image_process.cpp +++ b/hgdriver/hgdev/image_process.cpp @@ -29,7 +29,7 @@ using namespace std; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // functional ... //////////////////////////////////////////////////////////////////////////////// -// NEWflow ... +// NEW£¬flow ... static int num=0; namespace hg_imgproc @@ -127,7 +127,7 @@ namespace hg_imgproc if(buffs.empty()) return -1; -/////cmake当中进行定义 mips64 //在mips64下使用reset会导致崩? +/////cmake当中进行定义 mips64 //在mips64下使用reset会导致崩�? //#ifndef mips64 //printf("\n buffer_ reset"); buffer_.reset(new std::vector()); @@ -452,7 +452,7 @@ namespace hg_imgproc return ret; } - int customgamma(int is_customgamma) + int customgamma(bool is_customgamma,unsigned char* table,int tableLength) { int ret = HG_ERR_OK; std::vector mats(mats_); @@ -460,7 +460,8 @@ namespace hg_imgproc if(is_customgamma) { - //CImageApplyCustomGamma gamme(); //暂留 + CImageApplyCustomGamma gamme(table,tableLength); + gamme.apply(mats,img_conf_.is_duplex); } else { @@ -474,14 +475,12 @@ namespace hg_imgproc justColors.apply(mats[i],img_conf_.is_duplex); } } - - mats_ = mats; - //cv::imwrite("/home/huagao/Desktop/customgamma2.jpg",mats_[0]); } + mats_ = mats; return ret; } - //防止渗? + //防止渗�? int antiInflow(int permeate_lv) { int ret = HG_ERR_OK; @@ -549,7 +548,7 @@ namespace hg_imgproc #endif return ret; } - //除网? + //除网�? int textureRemove() { int ret = HG_ERR_OK; @@ -623,7 +622,7 @@ namespace hg_imgproc std::vector mats(mats_); mats_.clear(); - double threshold = 40; //默认? + double threshold = 40; //默认�? int edge = 150; CImageApplyDiscardBlank(threshold,edge,img_conf_.discardblank_percent); @@ -639,7 +638,7 @@ namespace hg_imgproc } return ret; } - //答题卡出? + //答题卡出�? int answerSheetFilterRed() { int ret = HG_ERR_OK; @@ -830,9 +829,9 @@ namespace hg_imgproc { return ((imgproc*)himg)->channel(); } - int customgamma(HIMGPRC himg,int is_custogamma) + int customgamma(HIMGPRC himg,bool is_custogamma,unsigned char* table,int tableLength) { - return ((imgproc*)himg)->customgamma(is_custogamma); + return ((imgproc*)himg)->customgamma(is_custogamma,table,tableLength); } int antiInflow(HIMGPRC himg,int permeate_lv) { diff --git a/hgdriver/hgdev/image_process.h b/hgdriver/hgdev/image_process.h index 58a5313..b1d42d3 100644 --- a/hgdriver/hgdev/image_process.h +++ b/hgdriver/hgdev/image_process.h @@ -178,7 +178,7 @@ namespace hg_imgproc int resolution_change(HIMGPRC himg); int croprect(HIMGPRC himg); int channel(HIMGPRC himg); - int customgamma(HIMGPRC himg,int is_custogamma); + int customgamma(HIMGPRC himg,bool is_custogamma,unsigned char* table,int tableLength); int antiInflow(HIMGPRC himg,int permeate_lv); int colorCorrection(HIMGPRC himg); int orentation(HIMGPRC himg);