diff --git a/hgdriver/hgdev/hg_scanner_200.cpp b/hgdriver/hgdev/hg_scanner_200.cpp index 3a42282..8e74b11 100644 --- a/hgdriver/hgdev/hg_scanner_200.cpp +++ b/hgdriver/hgdev/hg_scanner_200.cpp @@ -628,8 +628,40 @@ void hg_scanner_200::image_process(std::shared_ptr>& buffer) //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n"); } /////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// - int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); - hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength); + int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); + + unsigned char buffer1[256 *3]; + if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY) + tableLength = 256; + else + { + tableLength = 768; + int index=0; + + unsigned char buf_01[256]; + memcpy(buf_01,custom_gamma_val_->table + index,256); + index += 256; + + unsigned char buf_02[256]; + memcpy(buf_02,custom_gamma_val_->table + index,256); + index += 256; + + unsigned char buf_03[256]; + memcpy(buf_03,custom_gamma_val_->table + index,256); + index += 256; + + int j =0; + for (size_t i = 0; i < 256; i++) + { + memcpy(buffer1 + j,buf_01 + i,1); + memcpy(buffer1 + (++j),buf_02 + i,1); + memcpy(buffer1 + (++j),buf_03 + i,1); + ++j; + } + } + + + hg_imgproc::customgamma(handle,custom_gamma_,buffer1,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 563a5d1..41d17c6 100644 --- a/hgdriver/hgdev/hg_scanner_300.cpp +++ b/hgdriver/hgdev/hg_scanner_300.cpp @@ -585,8 +585,40 @@ void hg_scanner_300::image_process(std::shared_ptr>& buffer) //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n"); } /////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// - int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); - hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength); + int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); + + unsigned char buffer1[256 *3]; + if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY) + tableLength = 256; + else + { + tableLength = 768; + int index=0; + + unsigned char buf_01[256]; + memcpy(buf_01,custom_gamma_val_->table + index,256); + index += 256; + + unsigned char buf_02[256]; + memcpy(buf_02,custom_gamma_val_->table + index,256); + index += 256; + + unsigned char buf_03[256]; + memcpy(buf_03,custom_gamma_val_->table + index,256); + index += 256; + + int j =0; + for (size_t i = 0; i < 256; i++) + { + memcpy(buffer1 + j,buf_01 + i,1); + memcpy(buffer1 + (++j),buf_02 + i,1); + memcpy(buffer1 + (++j),buf_03 + i,1); + ++j; + } + } + + + hg_imgproc::customgamma(handle,custom_gamma_,buffer1,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 f105211..f59697c 100644 --- a/hgdriver/hgdev/hg_scanner_400.cpp +++ b/hgdriver/hgdev/hg_scanner_400.cpp @@ -588,8 +588,40 @@ 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////////////////////////////////// - int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); - hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength); + int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); + + unsigned char buffer1[256 *3]; + if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY) + tableLength = 256; + else + { + tableLength = 768; + int index=0; + + unsigned char buf_01[256]; + memcpy(buf_01,custom_gamma_val_->table + index,256); + index += 256; + + unsigned char buf_02[256]; + memcpy(buf_02,custom_gamma_val_->table + index,256); + index += 256; + + unsigned char buf_03[256]; + memcpy(buf_03,custom_gamma_val_->table + index,256); + index += 256; + + int j =0; + for (size_t i = 0; i < 256; i++) + { + memcpy(buffer1 + j,buf_01 + i,1); + memcpy(buffer1 + (++j),buf_02 + i,1); + memcpy(buffer1 + (++j),buf_03 + i,1); + ++j; + } + } + + + hg_imgproc::customgamma(handle,custom_gamma_,buffer1,tableLength); if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) {