调整配置流程

This commit is contained in:
13038267101 2022-11-19 18:16:43 +08:00
parent 709945d398
commit 2afc2dca7d
13 changed files with 931 additions and 869 deletions

View File

@ -98,7 +98,7 @@ hg_scanner::hg_scanner(ScannerSerial serial
, double_paper_handle_(0), keep_watermark_(false), save_feedmode_type_(false), feedmode_(1), sleeptime_(-1),split3399_(0)
, async_io_(false), is_white_0_(true), isremove_left_hole(false), isremove_right_hole(false), isremove_top_hole(false), isremove_low_hole(false)
, isremove_left_hole_threshold(0), isremove_right_hole_threshold(0), isremove_top_hole_threshold(0), isremove_low_hole_threshold(0)
, dump_usb_path_(""),is_kernelsnap_211209_(false), pid_(0), dump_img_(&hg_scanner::dump_image_empty), is_kernelsnap_220830_(false)
, dump_usb_path_(""),is_kernelsnap_211209_(false), pid_(0), dump_img_(&hg_scanner::dump_image_empty), is_kernelsnap_220830_(false),is_kernelsnap3288_221106_(false)
{
init_setting_func_map();
final_path_ = hg_log::ini_get("paths", "final_img");
@ -996,192 +996,188 @@ int hg_scanner::hgpaper_to_devspaper(Paper_Map papermap[], int len, int& paper,
return ind;
}
//暂时放着
int hg_scanner::image_configuration(LPSCANCONF ic)
int hg_scanner::image_configuration(SCANCONF &ic)
{
int len = sizeof(ic),
ret = SCANNER_ERR_OK;
bzero(ic, len);
ic->papertype = paper_size_;
int ret = 0;
ic.papertype = paper_size_;
if (is_lateral(image_prc_param_.bits.paper))
ic->paperAlign = Rot270;
// else if (image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO)
// ic->paperAlign = AutoTextOrientation;
ic.paperAlign = Rot270;
else
ic->paperAlign = Rot0;
ic->en_sizecheck = size_check;
ic.paperAlign = Rot0;
//ic.en_sizecheck = dev_conf_.params_3399.enable_sizecheck; 子类处理
if (image_prc_param_.bits.text_direction != TEXT_DIRECTION_AUTO)
ic->imageRotateDegree = (float)image_prc_param_.bits.text_direction;
ic.imageRotateDegree = (float)image_prc_param_.bits.text_direction;
else
ic->imageRotateDegree = 0;
ic.imageRotateDegree = 0;
ic->imageRotateDegree *= 90.0f;
ic->is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE
ic.imageRotateDegree *= 90.0f;
ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT
|| image_prc_param_.bits.page == PAGE_FOLIO);
if (image_prc_param_.bits.page == PAGE_FOLIO)
ic.en_fold = (image_prc_param_.bits.page == PAGE_FOLIO);
ic.pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
ic.automaticcolor = is_auto_matic_color;
ic.automaticcolortype = 1;// ic.pixtype; //存疑
ic.resolution_dst = (resolution_ >= 300) ? (is_quality_ == IMG_SPEED ? 200 : resolution_) : resolution_;
//if (resolution_ >= 300)
//{
// if (is_quality_ == IMG_SPEED)
// ic.resolution_dst = 200;
// else
// ic.resolution_dst = resolution_;
//}
//else
// ic.resolution_dst = resolution_;
ic.resolution_native = 200.0f;
ic.gamma = (float)gamma_;
{
ic->en_fold = fold_type_;
//子类处理
/*ic.contrast = (contrast_ - 4) * 333.0;
ic.brightness = (bright_ - 128) * (2000.0 / 254.0);*/
}
ic.threshold = threshold_;
ic.is_autocontrast = 0; //无参数
ic.is_autocrop = (ic.papertype == TwSS::None || ic.papertype == TwSS::USStatement);
ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
ic.discardblank_percent = omit_empty_level_ >= 70 ? 70 : omit_empty_level_;
ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
ic.is_switchfrontback = image_prc_param_.bits.exchange;
ic.autodescrew = image_prc_param_.bits.automatic_skew;
//ic.multi_output_red = image_prc_param_.bits.rid_red; //必须屏蔽,否则超时,未知错误不可描述。
ic.hsvcorrect = image_prc_param_.bits.rid_answer_red;
ic.sharpen = image_prc_param_.bits.sharpen;
//ic.enhance_color = image_prc_param_.bits.rid_color; //加这个会有问题
ic.fillbackground = image_prc_param_.bits.erase_black_frame;
ic.is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
if (ic.resolution_dst == 300)
ic.noise = anti_noise_ * 1.5;
else if (ic.resolution_dst == 600)
ic.noise = anti_noise_ * 3;
else
{
ic->en_fold = 0;
}
ic.noise = anti_noise_;
ic->pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
ic->automaticcolor = is_auto_matic_color;
ic->automaticcolortype = 1;// ic->pixtype; //存疑
if (resolution_ >= 300)
ic.indent = margin_;
ic.AutoCrop_threshold = threshold_;
{
if (is_quality_ == IMG_SPEED)
//子类处理
//if (test_1_paper_)
//{
// LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
// ic.scannum = ic.is_duplex ? 2 : 1;
//}
//else
//{
// if (scan_count_ == -1)
// ic.scannum = -1;
// else
// ic.scannum = (ic.is_duplex ? scan_count_ * 2 : scan_count_);
//}
}
ic.is_backrotate180 = image_prc_param_.bits.rotate_back_180;
ic.is_dogeardetection = image_prc_param_.bits.fractate_check;
{
ic->resolution_dst = 200;
//子类处理
//ic.hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
//ic.hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
//ic.hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
//ic.hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
//ic.hardwarecaps.is_autopaper = dev_conf_.params_3399.is_autopaper;
}
else if (is_quality_ == IMG_QUALITY)
ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
ic.fillhole.is_fillhole = image_prc_param_.bits.rid_hole;
ic.fillhole.fillholeratio = rid_hole_range_;
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;
ic.isfillcolor = is_color_fill;
ic.refuseInflow = image_prc_param_.bits.is_permeate;
ic.colorCorrection = 0;
ic.removeMorr = image_prc_param_.bits.remove_morr;
ic.errorExtention = image_prc_param_.bits.error_extention;//
ic.textureRemove = image_prc_param_.bits.remove_txtture;//
ic.splitImage = image_prc_param_.bits.split;
{
ic->resolution_dst = resolution_;
}
}
else
{
ic->resolution_dst = resolution_;
}
ic->resolution_native = 200.0f;
ic->gamma = (float)gamma_;
ic->contrast = (contrast_ - 4) * 333.0;
ic->brightness = (bright_ - 128) * (2000.0 / 254.0);
ic->threshold = threshold_;
ic->is_autocontrast = 0; //无参数
ic->is_autocrop = (ic->papertype == TwSS::None || ic->papertype == TwSS::USStatement);
ic->is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
ic->discardblank_percent = omit_empty_level_ >= 70 ? 70 : omit_empty_level_;
ic->is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
ic->is_switchfrontback = image_prc_param_.bits.exchange;
ic->autodescrew = image_prc_param_.bits.automatic_skew;
//ic->multi_output_red = image_prc_param_.bits.rid_red; //必须屏蔽,否则超时,未知错误不可描述。
ic->hsvcorrect = image_prc_param_.bits.rid_answer_red;
ic->sharpen = image_prc_param_.bits.sharpen;
//ic->enhance_color = image_prc_param_.bits.rid_color; //加这个会有问题
ic->fillbackground = image_prc_param_.bits.erase_black_frame;
ic->is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
if (ic->resolution_dst == 300)
ic->noise = anti_noise_ * 1.5;
else if (ic->resolution_dst == 600)
ic->noise = anti_noise_ * 3;
else
ic->noise = anti_noise_;
ic->indent = margin_;
ic->AutoCrop_threshold = threshold_;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic->scannum = ic->is_duplex ? 2 : 1;
}
else
{
if (scan_count_ == -1)
ic->scannum = -1;
else
ic->scannum = (ic->is_duplex ? scan_count_ * 2 : scan_count_);
}
ic->is_backrotate180 = image_prc_param_.bits.rotate_back_180;
ic->is_dogeardetection = image_prc_param_.bits.fractate_check;
//ic->hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
//ic->hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
//ic->hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
//ic->hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
// ic->hardwarecaps.is_autopaper = dev_conf_.params_3399.is_autopaper;
ic->hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
ic->hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
ic->fillhole.is_fillhole = image_prc_param_.bits.rid_hole;
ic->fillhole.fillholeratio = rid_hole_range_;
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;
ic->isfillcolor = is_color_fill;
ic->refuseInflow = image_prc_param_.bits.is_permeate;
ic->colorCorrection = 0;
ic->removeMorr = image_prc_param_.bits.remove_morr;
ic->errorExtention = image_prc_param_.bits.error_extention;//
ic->textureRemove = image_prc_param_.bits.remove_txtture;//
ic->splitImage = image_prc_param_.bits.split;
{
ic->cropRect.enable = custom_area_;
int height = (custom_area_br_y_ * ic->resolution_dst) / 25.4 - (custom_area_lt_y_ * ic->resolution_dst / 25.4);
int width = (custom_area_br_x_ * ic->resolution_dst) / 25.4 - (custom_area_lt_x_ * ic->resolution_dst / 25.4);
ic->cropRect.height = height;
ic->cropRect.width = width;
ic->cropRect.x = custom_area_lt_x_ * ic->resolution_dst / 25.4;
ic->cropRect.y = custom_area_lt_y_ * ic->resolution_dst / 25.4;
}
ic->multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
ic->normalCrop = image_prc_param_.bits.dark_sample;
ic->dogeardistabce = fractate_level_;
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);
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)
ic->filter = 3;
else
{
ic->filter = filter_clr[image_prc_param_.bits.rid_color];
// if(ic->filter != 3)
// ic->pixtype = 2;
ic->hsvcorrect = 0;
ic->multi_output_red = 0;
ic->multiOutput = MultiOutput::Unused;
}
//多留输出的处理
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW && is_multiout)
{
ic->pixtype = 1;
}
else if ((image_prc_param_.bits.multi_out == MULTI_OUT_ALL || image_prc_param_.bits.multi_out == MULTI_COLOR_AND_GRAY || image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW) && is_multiout)
{
ic->pixtype = 2;
ic.cropRect.enable = custom_area_;
int height = (custom_area_br_y_ * ic.resolution_dst) / 25.4 - (custom_area_lt_y_ * ic.resolution_dst / 25.4);
int width = (custom_area_br_x_ * ic.resolution_dst) / 25.4 - (custom_area_lt_x_ * ic.resolution_dst / 25.4);
ic.cropRect.height = height;
ic.cropRect.width = width;
ic.cropRect.x = custom_area_lt_x_ * ic.resolution_dst / 25.4;
ic.cropRect.y = custom_area_lt_y_ * ic.resolution_dst / 25.4;
}
ic.multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
ic.normalCrop = image_prc_param_.bits.dark_sample;
ic.dogeardistabce = fractate_level_;
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);
ic.fold_concatmode = fold_type_;
//多流输出优先级最高
if (is_multiout)
{
ic->hsvcorrect = 0;
ic->multi_output_red = 0;
ic->fadeback = false;
ic->sharpen = 0;
ic->removeMorr = 0;
ic->textureRemove = 0;
ic->errorExtention = 0;
ic->detachnoise.is_detachnoise = 0;
ic.pixtype = image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW ? COLOR_MODE_256_GRAY : COLOR_MODE_24_BITS;
ic.filter = 3;
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
if (ic->pixtype == 0)
else if (image_prc_param_.bits.multi_out == COLOR_MODE_24_BITS)
{
ic->hsvcorrect = 0;
ic->multi_output_red = 0;
ic->fadeback = false;
ic->sharpen = 0;
ic->removeMorr = 0;
ic->textureRemove = 0;
ic.filter = 3;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
else if (image_prc_param_.bits.multi_out == COLOR_MODE_256_GRAY)
{
int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
ic.filter = filter_clr[image_prc_param_.bits.rid_color];
ic.multi_output_red = 0;
ic.hsvcorrect = 0;
ic.fadeback = false;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
else if (image_prc_param_.bits.multi_out == COLOR_MODE_BLACK_WHITE)
{
int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
ic.filter = filter_clr[image_prc_param_.bits.rid_color];
ic.multi_output_red = 0;
ic.hsvcorrect = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
}
else if (image_prc_param_.bits.multi_out == COLOR_MODE_AUTO_MATCH)
{
ic.pixtype = 2;
ic.filter = 3;
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
//自定义裁切
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
|| image_prc_param_.bits.paper == PAPER_MAX_SIZE
@ -1189,72 +1185,61 @@ int hg_scanner::image_configuration(LPSCANCONF ic)
|| image_prc_param_.bits.paper == PAPER_TRIGEMINY
)
{
ic->cropRect.enable = false;
ic.cropRect.enable = false;
}
img_conf_ = ic;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.autodescrew=%d", ic.autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.automaticcolor=%d", ic.automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.brightness=%f", ic.brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.contrast=%f", ic.contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.en_fold=%d", ic.en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.en_sizecheck=%d", ic.en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.enhance_color=%d", ic.enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fillbackground=%d", ic.fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.filter=%d", ic.filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.gamma=%f", ic.gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.hsvcorrect=%d", ic.hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autocontrast=%d", ic.is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autocrop=%d", ic.is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autotext=%d", ic.is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_backrotate180=%d", ic.is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_convex=%d", ic.is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_duplex=%d", ic.is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.noise=%d", ic.noise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.resolution_dst=%f", ic.resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.resolution_native=%f", ic.resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.scannum=%d", ic.scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.sharpen=%d", ic.sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.discardblank_percent=%d", ic.discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.removeMorr=%d\r ", ic.removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.errorExtention=%d\r ", ic.errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.textureRemove=%d\r\n ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.ic.fillhole.fillholeratio=%d\r\n ", ic.fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fadeback=%d\r\n ", ic.fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.enable=%d\r ", ic.cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.width=%d\r\n ", ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.height=%d\r\n ", ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.x=%d\r\n ", ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.y=%d\r\n ", ic.cropRect.y);
{
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->write_bulk(&ic, &len);
this_thread::sleep_for(chrono::milliseconds(500));
io_->set_timeout(2000);//必要延时
}
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write-down 0x%x bytes image process parameters\n", len);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->pixtype=%d", ic->pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->papertype=%d", ic->papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->AutoCrop_threshold=%d", ic->AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->autodescrew=%d", ic->autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->automaticcolor=%d", ic->automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->brightness=%f", ic->brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->contrast=%f", ic->contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->en_fold=%d", ic->en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->en_sizecheck=%d", ic->en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->enhance_color=%d", ic->enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->fillbackground=%d", ic->fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->filter=%d", ic->filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->gamma=%f", ic->gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->hardwarecaps.capturepixtype=%d", ic->hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->hardwarecaps.en_doublefeed=%d", ic->hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->hsvcorrect=%d", ic->hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->imageRotateDegree=%f", ic->imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_autocontrast=%d", ic->is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_autocrop=%d", ic->is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_autodiscradblank_normal=%d", ic->is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_autodiscradblank_vince=%d", ic->is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_autotext=%d", ic->is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_backrotate180=%d", ic->is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_convex=%d", ic->is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_duplex=%d", ic->is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_switchfrontback=%d", ic->is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->is_dogeardetection=%d", ic->is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->fillhole.multi_output_red=%d", ic->multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->noise=%d", ic->noise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->pixtype=%d", ic->pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->resolution_dst=%f", ic->resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->resolution_native=%f", ic->resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->scannum=%d", ic->scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->sharpen=%d", ic->sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->discardblank_percent=%d", ic->discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->detachnoise.is_detachnoise=%d", ic->detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->detachnoise.detachnoise=%d\r ", ic->detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->detachnoise.refuseInflow=%d\r ", ic->refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->detachnoise.refuseInflow=%d\r ", ic->refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->removeMorr=%d\r ", ic->removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->errorExtention=%d\r ", ic->errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->textureRemove=%d\r\n ", ic->refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->fillhole.is_fillhole=%d\r\n ", ic->fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->ic->fillhole.fillholeratio=%d\r\n ", ic->fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->fadeback=%d\r\n ", ic->fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->cropRect.enable=%d\r ", ic->cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->cropRect.width=%d\r\n ", ic->cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->cropRect.height=%d\r\n ", ic->cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->cropRect.x=%d\r\n ", ic->cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic->cropRect.y=%d\r\n ", ic->cropRect.y);
img_conf_ = *ic;
return ret;
}
int hg_scanner::invoke_setting_xxx(int(hg_scanner::*func)(void*), void* data)
@ -1370,14 +1355,14 @@ int hg_scanner::setting_multi_out(void* data)
int val = image_prc_param_.bits.color_mode;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "image_prc_param_.bits.multi_out %d\n", image_prc_param_.bits.multi_out);
if (is_multiout)
{
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW)
val = COLOR_MODE_256_GRAY;
else
val = COLOR_MODE_24_BITS;
}
on_color_mode_changed(val);
//if (is_multiout)
//{
// if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW)
// val = COLOR_MODE_256_GRAY;
// else
// val = COLOR_MODE_24_BITS;
//}
//on_color_mode_changed(val);
return SCANNER_ERR_OK;
}
@ -1394,26 +1379,25 @@ int hg_scanner::setting_multi_out_type(void* data)
save_multiout = str;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "set multi_out type from %s to %s = %s\n", multi_out_string(image_prc_param_.bits.multi_out).c_str(), (char*)data, hg_scanner_err_name(ret));
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW)
/*if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW)
color = COLOR_MODE_256_GRAY;
else
color = COLOR_MODE_24_BITS;
on_color_mode_changed(color);
on_color_mode_changed(color);*/
return ret;
}
int hg_scanner::setting_rid_color(void* data)
{
std::string str((char*)data);
int ret = SCANNER_ERR_OK,
color = -1,
old = image_prc_param_.bits.rid_color;
bool exact = check_range(SANE_STD_OPT_NAME_FILTER, str);
image_prc_param_.bits.rid_color = match_best_rid_color(str, NULL);
on_color_mode_changed(color);
//on_color_mode_changed(color);
if (!exact)
{

View File

@ -281,6 +281,8 @@ protected:
bool is_kernelsnap_220830_; //此版本支持待纸扫描,手动睡眠唤醒,分纸强度
bool is_kernelsnap_211209_; //获取固件版本号是否是新旧版本
bool is_kernelsnap3288_221106_; //G300 3288 在221106版本支持真实dpi
SCANCONF img_conf_; //此参数外部不做任何改变请在writedown_image_configuration做修改
std::string img_type_;
@ -347,7 +349,7 @@ public:
int set_setting(const char* name, void* data, int len);
int get_setting(const char* name, char* json_txt_buf, int* len);
int hgpaper_to_devspaper(Paper_Map papermap[], int len, int& paper, bool* exact, TwSS* type);
int image_configuration(LPSCANCONF ic);
int image_configuration(SCANCONF &ic);
std::string name(void);
int status(void);
bool is_online(void);

View File

@ -223,7 +223,7 @@ int hg_scanner_200::start(void)
//discard_prev();
user_cancel_ = false;
//ret = writedown_device_configuration(true);
ret = writedown_device_configuration(true);
if (ret == SCANNER_ERR_OK)
writedown_image_configuration();
else
@ -417,6 +417,16 @@ int hg_scanner_200::writedown_device_configuration(bool type,setting_hardware::H
if (!d)
d = &dsp_config_;
if (is_multiout)
{
d->params_dsp.color = image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW ? 0 : 1;
}
else if ((image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY
|| image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
d->params_dsp.color = 1;
}
USBCB usbcb = { setting3288dsp::CONFIGURED_DATA, d->value, 0 };
len = sizeof(USBCB);
@ -429,18 +439,8 @@ int hg_scanner_200::writedown_device_configuration(bool type,setting_hardware::H
int hg_scanner_200::on_color_mode_changed(int& color_mode)
{
int ret = SCANNER_ERR_OK;
if (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY)
{
dsp_config_.params_dsp.color = 0;
}
else if(color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH)
{
dsp_config_.params_dsp.color = 1;
}
return ret;
dsp_config_.params_dsp.color = (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY) ? 0 : 1;
return SCANNER_ERR_OK;
}
int hg_scanner_200::on_paper_changed(int& paper)
{
@ -611,71 +611,20 @@ int hg_scanner_200::initdevice()
void hg_scanner_200::writedown_image_configuration(void)
{
SCANCONF ic;
int len = sizeof(ic);
ic.papertype = paper_size_;
bzero(&ic, len);
if (is_lateral(image_prc_param_.bits.paper))
ic.paperAlign = Rot270;
// else if (image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO)
// ic.paperAlign = AutoTextOrientation;
else
ic.paperAlign = Rot0;
ic.en_sizecheck = dsp_config_.params_dsp.enable_sizecheck;
if (image_prc_param_.bits.text_direction != TEXT_DIRECTION_AUTO)
ic.imageRotateDegree = image_prc_param_.bits.text_direction;
else
ic.imageRotateDegree = 0;
ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE || image_prc_param_.bits.page == PAGE_OMIT_EMPTY ||
image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT || image_prc_param_.bits.page ==PAGE_FOLIO);
ic.en_fold = (image_prc_param_.bits.page == PAGE_FOLIO);
ic.pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
ic.automaticcolor = is_auto_matic_color;
ic.automaticcolortype = 1;// ic.pixtype; //存疑
ic.resolution_dst = resolution_;
ic.resolution_native = 200;
ic.gamma = (float)gamma_;
ic.contrast = contrast_;
ic.brightness = bright_;
ic.threshold = threshold_;
ic.is_autocontrast = 0; //无参数
ic.is_autocrop = (ic.papertype == TwSS::None || ic.papertype ==TwSS::USStatement);
ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
ic.discardblank_percent = omit_empty_level_; //默认20
ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
ic.is_switchfrontback = image_prc_param_.bits.exchange;
ic.autodescrew = image_prc_param_.bits.automatic_skew;
ic.multi_output_red = image_prc_param_.bits.rid_red;
ic.hsvcorrect = image_prc_param_.bits.rid_answer_red;
ic.sharpen = image_prc_param_.bits.sharpen;
//ic.enhance_color = image_prc_param_.bits.rid_color;
ic.fillbackground = image_prc_param_.bits.erase_black_frame;
ic.is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
ic.noise = image_prc_param_.bits.noise_optimize;
ic.indent = margin_;
ic.AutoCrop_threshold = threshold_;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = 1;
}
else
{
ic.scannum = scan_count_;
}
ic.is_backrotate180 = image_prc_param_.bits.rotate_back_180;
ic.is_dogeardetection = image_prc_param_.bits.fractate_check;
ic.en_sizecheck = dsp_config_.params_dsp.enable_sizecheck;
ic.hardwarecaps.en_skrewdetect = dsp_config_.params_dsp.screw_detect_enable;
ic.hardwarecaps.en_doublefeed = dsp_config_.params_dsp.double_feed_enbale;
ic.hardwarecaps.en_stapledetect = dsp_config_.params_dsp.stable_enbale;
@ -684,153 +633,225 @@ else
ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
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;
ic.isfillcolor = is_color_fill;
ic.refuseInflow = image_prc_param_.bits.is_permeate;
ic.colorCorrection = 0;
ic.removeMorr = image_prc_param_.bits.remove_morr;
ic.errorExtention = image_prc_param_.bits.error_extention ;//暂无参数
ic.textureRemove = image_prc_param_.bits.remove_txtture;//暂无参数
ic.splitImage = image_prc_param_.bits.split;
//custom_area_br_x_ *ic.resolution_dst /25.4;
//custom_area_br_y_ *ic.resolution_dst /25.4;
ic.cropRect.enable = custom_area_;
int height = (custom_area_br_y_ *ic.resolution_dst) /25.4 - (custom_area_lt_y_ *ic.resolution_dst /25.4);
int width = (custom_area_br_x_ *ic.resolution_dst) /25.4 - (custom_area_lt_x_ *ic.resolution_dst /25.4);
ic.cropRect.height = height;
ic.cropRect.width = width;
ic.cropRect.x = custom_area_lt_x_ *ic.resolution_dst /25.4;
ic.cropRect.y = custom_area_lt_y_ *ic.resolution_dst /25.4;
ic.multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
if (!is_multiout)
{
ic.multiOutput = MultiOutput::Unused;
}
ic.normalCrop = image_prc_param_.bits.dark_sample;
ic.dogeardistabce = fractate_level_;
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;
ic.fold_concatmode = fold_type_;
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)
ic.filter = 3;
else
{
ic.filter = filter_clr[image_prc_param_.bits.rid_color];
// if(ic.filter != 3)
// ic.pixtype = 2;
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.multiOutput = MultiOutput::Unused;
ic.fadeback = false;
}
//多留输出的处理
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW && is_multiout)
{
ic.pixtype = 1;
}
else if ((image_prc_param_.bits.multi_out == MULTI_OUT_ALL ||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_GRAY||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW) && is_multiout)
{
ic.pixtype = 2;
}
if (is_multiout)
{
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
if (ic.pixtype == 0)
{
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
}
//自定义裁切
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
||image_prc_param_.bits.paper == PAPER_MAX_SIZE
||image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
||image_prc_param_.bits.paper == PAPER_TRIGEMINY
)
{
ic.cropRect.enable = false;
}
img_conf_ = ic;
image_configuration(ic);
agreement();
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
// ic.papertype = paper_size_;
//
// if (is_lateral(image_prc_param_.bits.paper))
// ic.paperAlign = Rot270;
// else
// ic.paperAlign = Rot0;
//
// ic.en_sizecheck = dsp_config_.params_dsp.enable_sizecheck;
//
//if (image_prc_param_.bits.text_direction != TEXT_DIRECTION_AUTO)
// ic.imageRotateDegree = image_prc_param_.bits.text_direction;
//else
// ic.imageRotateDegree = 0;
//
// ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE || image_prc_param_.bits.page == PAGE_OMIT_EMPTY ||
// image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT || image_prc_param_.bits.page ==PAGE_FOLIO);
//
// ic.en_fold = (image_prc_param_.bits.page == PAGE_FOLIO);
//
// ic.pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
//
// ic.automaticcolor = is_auto_matic_color;
// ic.automaticcolortype = 1;// ic.pixtype; //存疑
// ic.resolution_dst = resolution_;
// ic.resolution_native = 200;
//
// ic.gamma = (float)gamma_;
// ic.contrast = contrast_ ;
// ic.brightness = bright_ ;
// ic.threshold = threshold_;
// ic.is_autocontrast = 0; //无参数
// ic.is_autocrop = (ic.papertype == TwSS::None || ic.papertype ==TwSS::USStatement);
// ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
// ic.discardblank_percent = omit_empty_level_; //默认20
// ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
// ic.is_switchfrontback = image_prc_param_.bits.exchange;
// ic.autodescrew = image_prc_param_.bits.automatic_skew;
// ic.multi_output_red = image_prc_param_.bits.rid_red;
// ic.hsvcorrect = image_prc_param_.bits.rid_answer_red;
//
// ic.sharpen = image_prc_param_.bits.sharpen;
// //ic.enhance_color = image_prc_param_.bits.rid_color;
// ic.fillbackground = image_prc_param_.bits.erase_black_frame;
// ic.is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
// ic.noise = image_prc_param_.bits.noise_optimize;
// ic.indent = margin_;
// ic.AutoCrop_threshold = threshold_;
//
// if (test_1_paper_)
// {
// LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
// ic.scannum = 1;
// }
// else
// {
// ic.scannum = scan_count_;
// }
//
//
// ic.is_backrotate180 = image_prc_param_.bits.rotate_back_180;
// ic.is_dogeardetection = image_prc_param_.bits.fractate_check;
//
// ic.hardwarecaps.en_skrewdetect = dsp_config_.params_dsp.screw_detect_enable;
// ic.hardwarecaps.en_doublefeed = dsp_config_.params_dsp.double_feed_enbale;
// ic.hardwarecaps.en_stapledetect = dsp_config_.params_dsp.stable_enbale;
// ic.hardwarecaps.skrewdetectlevel = dsp_config_.params_dsp.screw_detect_level;
// // ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper;
// ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
// 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;
// ic.isfillcolor = is_color_fill;
// ic.refuseInflow = image_prc_param_.bits.is_permeate;
// ic.colorCorrection = 0;
// ic.removeMorr = image_prc_param_.bits.remove_morr;
// ic.errorExtention = image_prc_param_.bits.error_extention ;//暂无参数
// ic.textureRemove = image_prc_param_.bits.remove_txtture;//暂无参数
// ic.splitImage = image_prc_param_.bits.split;
//
// //custom_area_br_x_ *ic.resolution_dst /25.4;
// //custom_area_br_y_ *ic.resolution_dst /25.4;
//
// ic.cropRect.enable = custom_area_;
//
// int height = (custom_area_br_y_ *ic.resolution_dst) /25.4 - (custom_area_lt_y_ *ic.resolution_dst /25.4);
// int width = (custom_area_br_x_ *ic.resolution_dst) /25.4 - (custom_area_lt_x_ *ic.resolution_dst /25.4);
// ic.cropRect.height = height;
// ic.cropRect.width = width;
// ic.cropRect.x = custom_area_lt_x_ *ic.resolution_dst /25.4;
// ic.cropRect.y = custom_area_lt_y_ *ic.resolution_dst /25.4;
//
// ic.multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
// if (!is_multiout)
// {
// ic.multiOutput = MultiOutput::Unused;
// }
// ic.normalCrop = image_prc_param_.bits.dark_sample;
// ic.dogeardistabce = fractate_level_;
// 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;
// ic.fold_concatmode = fold_type_;
// 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)
// ic.filter = 3;
// else
// {
// ic.filter = filter_clr[image_prc_param_.bits.rid_color];
// // if(ic.filter != 3)
// // ic.pixtype = 2;
//
// ic.hsvcorrect = 0;
// ic.multi_output_red = 0;
// ic.multiOutput = MultiOutput::Unused;
// ic.fadeback = false;
// }
// //多留输出的处理
// if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW && is_multiout)
// {
// ic.pixtype = 1;
// }
// else if ((image_prc_param_.bits.multi_out == MULTI_OUT_ALL ||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_GRAY||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW) && is_multiout)
// {
// ic.pixtype = 2;
// }
// if (is_multiout)
// {
// ic.hsvcorrect = 0;
// ic.multi_output_red = 0;
// ic.fadeback = false;
// ic.sharpen = 0;
// ic.removeMorr = 0;
// ic.textureRemove = 0;
//
// ic.errorExtention = 0;
// ic.detachnoise.is_detachnoise = 0;
// }
// if (ic.pixtype == 0)
// {
// ic.hsvcorrect = 0;
// ic.multi_output_red = 0;
// ic.fadeback = false;
// ic.sharpen = 0;
// ic.removeMorr = 0;
// ic.textureRemove = 0;
// }
//
// //自定义裁切
// if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
// ||image_prc_param_.bits.paper == PAPER_MAX_SIZE
// ||image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
// ||image_prc_param_.bits.paper == PAPER_TRIGEMINY
// )
// {
// ic.cropRect.enable = false;
// }
// img_conf_ = ic;
//
// agreement();
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
}
void hg_scanner_200::printf_devconfig(setting_hardware::HGSCANCONF_DSP *d)
@ -892,13 +913,13 @@ int hg_scanner_200::agreement()
int ret = SCANNER_ERR_OK;
if (image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
dsp_config_.params_dsp.color = 1;
}
//if (image_prc_param_.bits.rid_color != RID_COLOR_NONE)
//{
// dsp_config_.params_dsp.color = 1;
//}
//
ret = writedown_device_configuration(true);
io_->set_timeout(200);
//io_->set_timeout(200);
return ret;
}

View File

@ -336,24 +336,24 @@ void hg_scanner_239::init_version(void)
is_kernelsnap_220830_ = false;
}
int hg_scanner_239::writedown_device_configuration(setting_hardware::HGSCANCONF_3399 *dev_conf)
int hg_scanner_239::writedown_device_configuration(bool type, setting_hardware::HGSCANCONF_3399* dev_conf)
{
int ret = SCANNER_ERR_OK;
if (!type)
return ret;
if (!dev_conf)
{
dev_conf = &dev_conf_;
if (is_multiout)
{
dev_conf->params_3399.color = image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW ? 0 : 1;
}
if (image_prc_param_.bits.rid_color != RID_COLOR_NONE
&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE))
else if ((image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY
|| image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
dev_conf->params_3399.color = 1;
}
else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE
&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE))
{
dev_conf->params_3399.color = 0;
}
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
|| image_prc_param_.bits.paper == PAPER_MAX_SIZE
@ -382,74 +382,11 @@ int hg_scanner_239::writedown_image_configuration(void)
int len = sizeof(ic);
bzero(&ic, len);
ic.papertype = paper_size_;
if (is_lateral(image_prc_param_.bits.paper))
ic.paperAlign = Rot270;
else
ic.paperAlign = Rot0;
ic.en_sizecheck = dev_conf_.params_3399.enable_sizecheck;
if (image_prc_param_.bits.text_direction != TEXT_DIRECTION_AUTO)
ic.imageRotateDegree = (float)image_prc_param_.bits.text_direction;
else
ic.imageRotateDegree = 0;
ic.imageRotateDegree *= 90.0f;
ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT
|| image_prc_param_.bits.page ==PAGE_FOLIO);
ic.en_fold = (image_prc_param_.bits.page == PAGE_FOLIO);
ic.pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
ic.automaticcolor = is_auto_matic_color;
ic.automaticcolortype = 1;// ic.pixtype; //存疑
if (resolution_ >= 300)
{
if(is_quality_ == IMG_SPEED)
{
ic.resolution_dst = 200;
}
else if(is_quality_ ==IMG_QUALITY)
{
ic.resolution_dst = resolution_;
}
}
else
{
ic.resolution_dst = resolution_;
}
ic.resolution_native = 200.0f;
ic.gamma = (float)gamma_;
ic.contrast = (contrast_ - 4) * 333.0;
ic.brightness = (bright_ - 128) * (2000.0 / 254.0);
ic.threshold = threshold_;
ic.is_autocontrast = 0; //无参数
ic.is_autocrop = (ic.papertype == TwSS::None || ic.papertype ==TwSS::USStatement);
ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
ic.discardblank_percent = omit_empty_level_ >= 70 ? 70 : omit_empty_level_;
ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
ic.is_switchfrontback = image_prc_param_.bits.exchange;
ic.autodescrew = image_prc_param_.bits.automatic_skew;
//ic.multi_output_red = image_prc_param_.bits.rid_red; //必须屏蔽,否则超时,未知错误不可描述。
ic.hsvcorrect = image_prc_param_.bits.rid_answer_red;
ic.sharpen = image_prc_param_.bits.sharpen;
//ic.enhance_color = image_prc_param_.bits.rid_color; //加这个会有问题
ic.fillbackground = image_prc_param_.bits.erase_black_frame;
ic.is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
if (ic.resolution_dst == 300)
ic.noise = anti_noise_ * 1.5;
else if(ic.resolution_dst == 600)
ic.noise = anti_noise_ * 3;
else
ic.noise = anti_noise_;
ic.indent = margin_;
ic.AutoCrop_threshold = threshold_;
ic.hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
ic.hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
ic.hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
ic.hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
@ -462,100 +399,191 @@ int hg_scanner_239::writedown_image_configuration(void)
else
ic.scannum = (ic.is_duplex ? scan_count_ * 2 : scan_count_);
}
ic.is_backrotate180 = image_prc_param_.bits.rotate_back_180;
ic.is_dogeardetection = image_prc_param_.bits.fractate_check;
ic.hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
ic.hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
ic.hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
ic.hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
// ic.hardwarecaps.is_autopaper = dev_conf_.params_3399.is_autopaper;
ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
ic.fillhole.is_fillhole = image_prc_param_.bits.rid_hole;
ic.fillhole.fillholeratio = rid_hole_range_;
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;
ic.isfillcolor = is_color_fill;
ic.refuseInflow = image_prc_param_.bits.is_permeate;
ic.colorCorrection = 0;
ic.removeMorr = image_prc_param_.bits.remove_morr;
ic.errorExtention = image_prc_param_.bits.error_extention ;//
ic.textureRemove = image_prc_param_.bits.remove_txtture;//
ic.splitImage = image_prc_param_.bits.split;
{
ic.cropRect.enable = custom_area_;
int height = (custom_area_br_y_ *ic.resolution_dst) /25.4 - (custom_area_lt_y_ *ic.resolution_dst /25.4);
int width = (custom_area_br_x_ *ic.resolution_dst) /25.4 - (custom_area_lt_x_ *ic.resolution_dst /25.4);
ic.cropRect.height = height;
ic.cropRect.width = width;
ic.cropRect.x = custom_area_lt_x_ *ic.resolution_dst /25.4;
ic.cropRect.y = custom_area_lt_y_ *ic.resolution_dst /25.4;
}
ic.multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
ic.normalCrop = image_prc_param_.bits.dark_sample;
ic.dogeardistabce = fractate_level_;
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);
ic.fold_concatmode = fold_type_;
//多流输出优先级最高
if (is_multiout)
{
ic.pixtype = image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW ? COLOR_MODE_256_GRAY : COLOR_MODE_24_BITS;
ic.filter = 3;
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
else if(image_prc_param_.bits.multi_out == COLOR_MODE_24_BITS)
{
ic.filter = 3;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
else if (image_prc_param_.bits.multi_out == COLOR_MODE_256_GRAY)
{
int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
ic.filter = filter_clr[image_prc_param_.bits.rid_color];
ic.multi_output_red = 0;
ic.hsvcorrect = 0;
ic.fadeback = false;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
}
else if (image_prc_param_.bits.multi_out == COLOR_MODE_BLACK_WHITE)
{
int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
ic.filter = filter_clr[image_prc_param_.bits.rid_color];
ic.multi_output_red = 0;
ic.hsvcorrect = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
}
else if (image_prc_param_.bits.multi_out == COLOR_MODE_AUTO_MATCH)
{
ic.pixtype = 2;
ic.filter = 3;
ic.hsvcorrect = 0;
ic.multi_output_red = 0;
ic.fadeback = false;
ic.sharpen = 0;
ic.removeMorr = 0;
ic.textureRemove = 0;
ic.errorExtention = 0;
ic.detachnoise.is_detachnoise = 0;
ic.contrast = (contrast_ - 4) * 333.0;
ic.brightness = (bright_ - 128) * (2000.0 / 254.0);
image_configuration(ic);
}
{
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->write_bulk(&ic, &len);
this_thread::sleep_for(chrono::milliseconds(500));
io_->set_timeout(2000);//必要延时
}
// ic.papertype = paper_size_;
//
// if (is_lateral(image_prc_param_.bits.paper))
// ic.paperAlign = Rot270;
// else
// ic.paperAlign = Rot0;
//
// ic.en_sizecheck = dev_conf_.params_3399.enable_sizecheck;
//
// if (image_prc_param_.bits.text_direction != TEXT_DIRECTION_AUTO)
// ic.imageRotateDegree = (float)image_prc_param_.bits.text_direction;
// else
// ic.imageRotateDegree = 0;
//
// ic.imageRotateDegree *= 90.0f;
// ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE
// || image_prc_param_.bits.page == PAGE_OMIT_EMPTY
// || image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT
// || image_prc_param_.bits.page ==PAGE_FOLIO);
//
// ic.en_fold = (image_prc_param_.bits.page == PAGE_FOLIO);
// ic.pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
// ic.automaticcolor = is_auto_matic_color;
// ic.automaticcolortype = 1;// ic.pixtype; //存疑
// if (resolution_ >= 300)
// {
// if(is_quality_ == IMG_SPEED)
// {
// ic.resolution_dst = 200;
// }
// else if(is_quality_ ==IMG_QUALITY)
// {
// ic.resolution_dst = resolution_;
// }
// }
// else
// {
// ic.resolution_dst = resolution_;
// }
//
// ic.resolution_native = 200.0f;
// ic.gamma = (float)gamma_;
// ic.contrast = (contrast_ - 4) * 333.0;
// ic.brightness = (bright_ - 128) * (2000.0 / 254.0);
// ic.threshold = threshold_;
// ic.is_autocontrast = 0; //无参数
// ic.is_autocrop = (ic.papertype == TwSS::None || ic.papertype ==TwSS::USStatement);
// ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
// ic.discardblank_percent = omit_empty_level_ >= 70 ? 70 : omit_empty_level_;
// ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
// ic.is_switchfrontback = image_prc_param_.bits.exchange;
// ic.autodescrew = image_prc_param_.bits.automatic_skew;
// //ic.multi_output_red = image_prc_param_.bits.rid_red; //必须屏蔽,否则超时,未知错误不可描述。
// ic.hsvcorrect = image_prc_param_.bits.rid_answer_red;
// ic.sharpen = image_prc_param_.bits.sharpen;
// //ic.enhance_color = image_prc_param_.bits.rid_color; //加这个会有问题
// ic.fillbackground = image_prc_param_.bits.erase_black_frame;
// ic.is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
// if (ic.resolution_dst == 300)
// ic.noise = anti_noise_ * 1.5;
// else if(ic.resolution_dst == 600)
// ic.noise = anti_noise_ * 3;
// else
// ic.noise = anti_noise_;
//
// ic.indent = margin_;
// ic.AutoCrop_threshold = threshold_;
// if (test_1_paper_)
// {
// LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
// ic.scannum = ic.is_duplex ? 2 : 1;
// }
// else
// {
// if (scan_count_ == -1)
// ic.scannum = -1;
// else
// ic.scannum = (ic.is_duplex ? scan_count_ * 2 : scan_count_);
// }
// ic.is_backrotate180 = image_prc_param_.bits.rotate_back_180;
// ic.is_dogeardetection = image_prc_param_.bits.fractate_check;
// ic.hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
// ic.hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
// ic.hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
// ic.hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
// // ic.hardwarecaps.is_autopaper = dev_conf_.params_3399.is_autopaper;
// ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
// ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
// ic.fillhole.is_fillhole = image_prc_param_.bits.rid_hole;
// ic.fillhole.fillholeratio = rid_hole_range_;
// 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;
// ic.isfillcolor = is_color_fill;
// ic.refuseInflow = image_prc_param_.bits.is_permeate;
// ic.colorCorrection = 0;
// ic.removeMorr = image_prc_param_.bits.remove_morr;
// ic.errorExtention = image_prc_param_.bits.error_extention ;//
// ic.textureRemove = image_prc_param_.bits.remove_txtture;//
// ic.splitImage = image_prc_param_.bits.split;
//{
// ic.cropRect.enable = custom_area_;
// int height = (custom_area_br_y_ *ic.resolution_dst) /25.4 - (custom_area_lt_y_ *ic.resolution_dst /25.4);
// int width = (custom_area_br_x_ *ic.resolution_dst) /25.4 - (custom_area_lt_x_ *ic.resolution_dst /25.4);
// ic.cropRect.height = height;
// ic.cropRect.width = width;
// ic.cropRect.x = custom_area_lt_x_ *ic.resolution_dst /25.4;
// ic.cropRect.y = custom_area_lt_y_ *ic.resolution_dst /25.4;
//}
// ic.multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
// ic.normalCrop = image_prc_param_.bits.dark_sample;
// ic.dogeardistabce = fractate_level_;
// 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);
// ic.fold_concatmode = fold_type_;
////多流输出优先级最高
// if (is_multiout)
// {
// ic.pixtype = image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW ? COLOR_MODE_256_GRAY : COLOR_MODE_24_BITS;
// ic.filter = 3;
// ic.hsvcorrect = 0;
// ic.multi_output_red = 0;
// ic.fadeback = false;
// ic.sharpen = 0;
// ic.removeMorr = 0;
// ic.textureRemove = 0;
// ic.errorExtention = 0;
// ic.detachnoise.is_detachnoise = 0;
// }
// else if(image_prc_param_.bits.multi_out == COLOR_MODE_24_BITS)
// {
// ic.filter = 3;
// ic.errorExtention = 0;
// ic.detachnoise.is_detachnoise = 0;
// }
// else if (image_prc_param_.bits.multi_out == COLOR_MODE_256_GRAY)
// {
// int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
// ic.filter = filter_clr[image_prc_param_.bits.rid_color];
// ic.multi_output_red = 0;
// ic.hsvcorrect = 0;
// ic.fadeback = false;
// ic.errorExtention = 0;
// ic.detachnoise.is_detachnoise = 0;
// }
// else if (image_prc_param_.bits.multi_out == COLOR_MODE_BLACK_WHITE)
// {
// int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
// ic.filter = filter_clr[image_prc_param_.bits.rid_color];
// ic.multi_output_red = 0;
// ic.hsvcorrect = 0;
// ic.fadeback = false;
// ic.sharpen = 0;
// ic.removeMorr = 0;
// ic.textureRemove = 0;
// }
// else if (image_prc_param_.bits.multi_out == COLOR_MODE_AUTO_MATCH)
// {
// ic.pixtype = 2;
// ic.filter = 3;
// ic.hsvcorrect = 0;
// ic.multi_output_red = 0;
// ic.fadeback = false;
// ic.sharpen = 0;
// ic.removeMorr = 0;
// ic.textureRemove = 0;
// ic.errorExtention = 0;
// ic.detachnoise.is_detachnoise = 0;
//
// }
//
/*if (ic.filter != 3 && (image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE || image_prc_param_.bits.color_mode != COLOR_MODE_256_GRAY))
@ -598,25 +626,18 @@ int hg_scanner_239::writedown_image_configuration(void)
}*/
//自定义裁切
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
/*if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
||image_prc_param_.bits.paper == PAPER_MAX_SIZE
||image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
||image_prc_param_.bits.paper == PAPER_TRIGEMINY
)
{
ic.cropRect.enable = false;
}
}*/
{
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->write_bulk(&ic, &len);
this_thread::sleep_for(chrono::milliseconds(500));
io_->set_timeout(2000);//必要延时
}
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write-down 0x%x bytes image process parameters\n", len);
/*VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write-down 0x%x bytes image process parameters\n", len);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
@ -669,7 +690,7 @@ int hg_scanner_239::writedown_image_configuration(void)
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ", ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
img_conf_ = ic;
img_conf_ = ic;*/
return ret;
}
@ -813,7 +834,12 @@ void hg_scanner_239::discard_all_images(void)
//color_mode =-1 除色选项
int hg_scanner_239::on_color_mode_changed(int& color_mode)
{
int ret = SCANNER_ERR_OK;
dev_conf_.params_3399.color = (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY) ? 0 : 1;
return SCANNER_ERR_OK;
/*int ret = SCANNER_ERR_OK;
if ((((color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH) && !dev_conf_.params_3399.color) ||
((color_mode != COLOR_MODE_24_BITS && color_mode != COLOR_MODE_AUTO_MATCH) && dev_conf_.params_3399.color)) && color_mode != -1)
@ -827,33 +853,7 @@ int hg_scanner_239::on_color_mode_changed(int& color_mode)
{
dev_conf_.params_3399.color = 1;
}
//setting_hardware::HGSCANCONF_3399 d = dev_conf_;
/*if (image_prc_param_.bits.rid_color != RID_COLOR_NONE
&&(image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
)
{
d.params_3399.color = 1;
ret = writedown_device_configuration(&d);
}*/
//if(image_prc_param_.bits.rid_color != RID_COLOR_NONE
//&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
//&& color_mode == -1)
//{
// d.params_3399.color = 1;
//}
//else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE
//&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
//&& color_mode == -1)
//{
// d.params_3399.color = 0;
//}
//if(color_mode == -1)
//ret = writedown_device_configuration(&d);
return ret;
return ret;*/
}
int hg_scanner_239::on_paper_changed(int& paper)
{
@ -900,45 +900,10 @@ int hg_scanner_239::on_paper_check_changed(bool& check)
check = dev_conf_.params_3399.enable_sizecheck;
}
}
//if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
// || image_prc_param_.bits.paper == PAPER_MAX_SIZE
// || image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
// || image_prc_param_.bits.paper == PAPER_TRIGEMINY
// || image_prc_param_.bits.paper == PAPER_16K
// || image_prc_param_.bits.paper == PAPER_8K
// || image_prc_param_.bits.paper == PAPER_16K_LATERAL
// )
//{
// setting_hardware::HGSCANCONF_3399* d = &dev_conf_;
// d->params_3399.enable_sizecheck = false;
// ret = writedown_device_configuration(d);
//}
return ret;
}
int hg_scanner_239::on_resolution_changed(int& dpi)
{
//bool exact = true;
//int ind = settings::match_best_resolution(dpi, &exact),
// ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
//if (dev_conf_.params_3399.dpi != settings::resolution_map[ind].dev_value)
//{
// int old = dev_conf_.params_3399.dpi;
// dev_conf_.params_3399.dpi = settings::resolution_map[ind].dev_value;
// dev_conf_.params_3399.dpi = 1;
// ret = writedown_device_configuration();
// if (ret)
// {
// dev_conf_.params_3399.dpi = old;
// }
// else if (!exact)
// ret = SCANNER_ERR_NOT_EXACT;
//}
//
//if (ret == SCANNER_ERR_NOT_EXACT)
// dpi = settings::resolution_map[ind].resolution;
//return ret;
dev_conf_.params_3399.dpi = 1; //dpi 华凌cis和敦南cis 默认发1无需改变
int ret = writedown_device_configuration();
return ret;
@ -1373,7 +1338,7 @@ int hg_scanner_239::start(void)
notify_ui_working_status(STATU_DESC_REWRITE_CONFIGURATION);
if(ret == SCANNER_ERR_OK)
{
ret = writedown_device_configuration();
ret = writedown_device_configuration(true);
}
if(ret == SCANNER_ERR_OK)

View File

@ -37,7 +37,7 @@ class hg_scanner_239 : public hg_scanner
int read_register(int addr, int* val);
int write_register(int addr, int val);
int write_command(int cmd);
int writedown_device_configuration(setting_hardware::HGSCANCONF_3399* dev_conf = NULL);
int writedown_device_configuration(bool type = false, setting_hardware::HGSCANCONF_3399* dev_conf = NULL);//false 在start再把type置为true,其他做设置时不发
int writedown_image_configuration(void);
int pop_first_image(void);
int read_one_image_from_usb(SANE_Image_Statu statu = SANE_Image_Statu_OK);

View File

@ -71,6 +71,10 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_sc
pid_ = pid;
string fw = get_firmware_version();
if (atoi(fw.substr(4, 9).c_str()) >= 221106)
is_kernelsnap3288_221106_ = true;
else
is_kernelsnap3288_221106_ = false;
initdevice();
#ifndef MAPPING_FUNCTION_IN_BASE
init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化
@ -380,12 +384,28 @@ int hg_scanner_300::writedown_device_configuration(bool type,setting_hardware::H
int ret = SCANNER_ERR_OK,
len = 0;
SIZE size;
if (!d)
{
dsp_config.params_3288.lutmode = keep_watermark_;
d = &dsp_config;
}
if (is_multiout)
{
d->params_3288.isColor = image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW ? 0 : 1;
}
else if ((image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY
|| image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
d->params_3288.isColor = 1;
}
if (img_conf_.is_autocrop)
{
d->params_3288.pageSize = setting3288dsp::G400_AUTO;
}
size = papersize.GetPaperSize(TwSS::A4, 200, img_conf_.paperAlign);
dsp_config.params_3288.dstHeight = (int)((size.cy + 200) / 100);
USBCB usbcb = { setting3288dsp::CONFIGURED_DATA, d->value, 0};
len = sizeof(USBCB);
@ -398,42 +418,8 @@ int hg_scanner_300::writedown_device_configuration(bool type,setting_hardware::H
int hg_scanner_300::on_color_mode_changed(int& color_mode)
{
int ret = SCANNER_ERR_OK;
// if ((((color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH) && !dsp_config.params_3288.color) ||
// ((color_mode != COLOR_MODE_24_BITS && color_mode != COLOR_MODE_AUTO_MATCH) && dsp_config.params_3288.color)) && color_mode != -1)
// {
// printf("color_mode111111111111111111111 =%d\r\n",color_mode);
// dsp_config.params_3288.color ^= 1;
// //ret = writedown_device_configuration();
// printf("on_color_mode_changed ret =%d\r\n",ret);
// if(ret)
// dsp_config.params_3288.color ^= 1;
// }
if (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY)
{
dsp_config.params_3288.isColor = 0;
}
else if(color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH)
{
dsp_config.params_3288.isColor = 1;
}
setting_hardware::HGSCANCONF_3288 d = dsp_config;
if(image_prc_param_.bits.rid_color != RID_COLOR_NONE && image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY && color_mode == -1)
{
d.params_3288.isColor = 1;
}
else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE && image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY && color_mode == -1)
{
d.params_3288.isColor = 0;
}
if(color_mode == -1)
ret = writedown_device_configuration(false,&d);
return ret;
dsp_config.params_3288.isColor = (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY) ? 0 : 1;
return SCANNER_ERR_OK;
}
int hg_scanner_300::on_paper_changed(int& paper)
{
@ -483,7 +469,8 @@ int hg_scanner_300::on_paper_check_changed(bool& check)
int hg_scanner_300::on_resolution_changed(int& dpi)
{
int ret = SCANNER_ERR_OK;
dsp_config.params_3288.dpi = 1;
dsp_config.params_3288.dpi = is_kernelsnap3288_221106_ ? (dsp_config.params_3288.dpi = (dpi > 200) ? 2 : 1) : dsp_config.params_3288.dpi = 1;//暂时还未有固件支持
ret = writedown_device_configuration();
return ret;
}
@ -512,17 +499,7 @@ int hg_scanner_300::agreement(TwSS tw,int align)
setting_hardware::HGSCANCONF_3288 d = dsp_config;
size = papersize.GetPaperSize(TwSS::A4,200,align);
dsp_config.params_3288.dstHeight = (int)((size.cy + 200)/100);
if (img_conf_.is_autocrop)
{
dsp_config.params_3288.pageSize = setting3288dsp::G400_AUTO;
}
if (img_conf_.filter != 3)
{
d.params_3288.isColor = 1;
}
ret = writedown_device_configuration(true,&d);
//io_->set_timeout(200);
return ret;
}
int hg_scanner_300::initdevice()
@ -542,6 +519,35 @@ int hg_scanner_300::initdevice()
void hg_scanner_300::writedown_image_configuration(void)
{
SCANCONF ic;
int len = sizeof(ic);
bzero(&ic, len);
ic.contrast = contrast_;
ic.brightness = bright_;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = 1;
}
else
ic.scannum = scan_count_;
ic.en_sizecheck = dsp_config.params_3288.enableSizeDetect;
ic.hardwarecaps.en_skrewdetect = 0;
ic.hardwarecaps.en_doublefeed = dsp_config.params_3288.doubleFeeded;
ic.hardwarecaps.en_stapledetect = 0;
ic.hardwarecaps.skrewdetectlevel = 0;
// ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper;
ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
image_configuration(ic);
//int ret = agreement((TwSS)img_conf_.papertype, img_conf_.paperAlign);
/*SCANCONF ic;
ic.papertype = paper_size_;
@ -754,6 +760,7 @@ void hg_scanner_300::writedown_image_configuration(void)
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
*/
}
void hg_scanner_300::printf_devconfig(setting_hardware::HGSCANCONF_3288 *d)
@ -993,20 +1000,6 @@ int hg_scanner_300::on_skew_check_level_changed(int& check)
return SCANNER_ERR_OK;
}
int hg_scanner_300::agreement()
{
int ret = SCANNER_ERR_OK;
if (image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
dsp_config.params_3288.isColor = 1;
}
ret = writedown_device_configuration(true);
//io_->set_timeout(200);
return ret;
}
int hg_scanner_300::on_set_feedmode(int feedmode)
{

View File

@ -47,7 +47,6 @@ public:
virtual int stop(void)override;
private:
int agreement();
int agreement(TwSS tw,int align);
int initdevice();
int writeusb(USBCB &usb);
@ -66,6 +65,7 @@ private:
setting_hardware::HGSCANCONF_3288 dsp_config;
Device::PaperSize papersize;
public:
virtual int set_leaflet_scan(void);//单张扫描
virtual int get_abuot_info(void);//获取软件关于信息

View File

@ -442,16 +442,37 @@ int hg_scanner_302::get_device_paperon_stautus(void)
// return ret;
// }
int hg_scanner_302::writedown_device_configuration(setting_hardware::HGSCANCONF_3399 *dev_conf)
int hg_scanner_302::writedown_device_configuration(bool type,setting_hardware::HGSCANCONF_3399 *dev_conf)
{
int ret = SCANNER_ERR_OK;
if (!type)
return ret;
if (!dev_conf)
{
dev_conf_.params_3399.is_textcorrect = !keep_watermark_;
dev_conf = &dev_conf_;
}
if (is_multiout)
{
dev_conf->params_3399.color = image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW ? 0 : 1;
}
else if ((image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY
|| image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
dev_conf->params_3399.color = 1;
}
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
|| image_prc_param_.bits.paper == PAPER_MAX_SIZE
|| image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
|| image_prc_param_.bits.paper == PAPER_TRIGEMINY
|| image_prc_param_.bits.paper == PAPER_16K
|| image_prc_param_.bits.paper == PAPER_8K
|| image_prc_param_.bits.paper == PAPER_16K_LATERAL
)
{
dev_conf->params_3399.enable_sizecheck = false;
}
ret = write_register(setting3399::SR_CONFIG_SCAN_PARAM, dev_conf->value);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf->value, hg_scanner_err_name(ret));
@ -460,16 +481,47 @@ int hg_scanner_302::writedown_device_configuration(setting_hardware::HGSCANCONF_
int hg_scanner_302::writedown_image_configuration(void)
{
//int ret = write_register(SR_CONFIF_IMGPROCPARAM, sizeof(SCANCONF));
//if (ret != SCANNER_ERR_OK)
// return ret;
int ret = SCANNER_ERR_OK;
SCANCONF ic;
int len = sizeof(ic);
bzero(&ic, len);
ic.en_sizecheck = dev_conf_.params_3399.enable_sizecheck;
ic.hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
ic.hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
ic.hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
ic.hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = /*ic.is_duplex ? 2 :*/ 1;
}
else
{
if (scan_count_ == -1)
ic.scannum = -1;
else
ic.scannum = (ic.is_duplex ? scan_count_ * 2 : scan_count_);
}
ic.contrast = (contrast_ - 4) * 333.0;
ic.brightness = (bright_ - 128) * (2000.0 / 254.0);
image_configuration(ic);
{
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->write_bulk(&ic, &len);
this_thread::sleep_for(chrono::milliseconds(500));
io_->set_timeout(2000);//必要延时
}
/*int ret = SCANNER_ERR_OK;
SCANCONF ic;
int len = sizeof(ic);
bzero(&ic, len);
ic.papertype = paper_size_;
if (is_lateral(image_prc_param_.bits.paper))
@ -540,7 +592,7 @@ int hg_scanner_302::writedown_image_configuration(void)
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = /*ic.is_duplex ? 2 :*/ 1;
ic.scannum = 1//ic.is_duplex ? 2 : 1;
}
else
{
@ -709,7 +761,7 @@ int hg_scanner_302::writedown_image_configuration(void)
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%f\r\n ", ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
img_conf_ = ic;
img_conf_ = ic*/
return ret;
}
@ -850,7 +902,12 @@ void hg_scanner_302::discard_all_images(void)
//color_mode =-1 除色选项
int hg_scanner_302::on_color_mode_changed(int& color_mode)
{
int ret = SCANNER_ERR_OK;
dev_conf_.params_3399.color = (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY) ? 0 : 1;
return SCANNER_ERR_OK;
/*int ret = SCANNER_ERR_OK;
if ((((color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH) && !dev_conf_.params_3399.color) ||
((color_mode != COLOR_MODE_24_BITS && color_mode != COLOR_MODE_AUTO_MATCH) && dev_conf_.params_3399.color)) && color_mode != -1)
@ -864,33 +921,7 @@ int hg_scanner_302::on_color_mode_changed(int& color_mode)
{
dev_conf_.params_3399.color = 1;
}
setting_hardware::HGSCANCONF_3399 d = dev_conf_;
if (image_prc_param_.bits.rid_color != RID_COLOR_NONE
&&(image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
)
{
d.params_3399.color = 1;
ret = writedown_device_configuration(&d);
}
if(image_prc_param_.bits.rid_color != RID_COLOR_NONE
&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& color_mode == -1)
{
d.params_3399.color = 1;
}
else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE
&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& color_mode == -1)
{
d.params_3399.color = 0;
}
if(color_mode == -1)
ret = writedown_device_configuration(&d);
return ret;
return ret;*/
}
int hg_scanner_302::on_paper_changed(int& paper)
{
@ -1262,8 +1293,14 @@ int hg_scanner_302::start(void)
return SCANNER_ERR_DEVICE_NO_PAPER;
}
notify_ui_working_status(STATU_DESC_REWRITE_CONFIGURATION);
writedown_device_configuration();
ret = writedown_device_configuration(true);
if (ret == SCANNER_ERR_OK)
writedown_image_configuration();
else
{
status_ = ret;
return ret;
}
val = 0;
ret = read_register(/*SR_GET_ANDROID_STATE*/0x1001, &val);

View File

@ -47,7 +47,7 @@ class hg_scanner_302 : public hg_scanner
int get_device_sleep_stautus(void);
int get_device_paperon_stautus(void);
int writedown_device_configuration(setting_hardware::HGSCANCONF_3399 *dev_conf = NULL);
int writedown_device_configuration(bool type =false,setting_hardware::HGSCANCONF_3399 *dev_conf = NULL);
int writedown_image_configuration(void);
int pop_first_image(void);

View File

@ -380,12 +380,28 @@ int hg_scanner_400::writedown_device_configuration(bool type,setting_hardware::H
int ret = SCANNER_ERR_OK,
len = 0;
SIZE size;
if (!d)
{
d = &dsp_config;
dsp_config.params_3288.lutmode = keep_watermark_;
d = &dsp_config;
}
if (is_multiout)
{
d->params_3288.isColor = image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW ? 0 : 1;
}
else if ((image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY
|| image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
d->params_3288.isColor = 1;
}
if (img_conf_.is_autocrop)
{
d->params_3288.pageSize = setting3288dsp::G400_AUTO;
}
size = papersize.GetPaperSize(TwSS::A4, 200, img_conf_.paperAlign);
dsp_config.params_3288.dstHeight = (int)((size.cy + 200) / 100);
USBCB usbcb = { setting3288dsp::CONFIGURED_DATA, d->value, 0 };
len = sizeof(USBCB);
@ -398,43 +414,8 @@ int hg_scanner_400::writedown_device_configuration(bool type,setting_hardware::H
int hg_scanner_400::on_color_mode_changed(int& color_mode)
{
int ret = SCANNER_ERR_OK;
//printf("color_mode =%d\r\n",color_mode);
// if ((((color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH) && !dsp_config.params_3288.color) ||
// ((color_mode != COLOR_MODE_24_BITS && color_mode != COLOR_MODE_AUTO_MATCH) && dsp_config.params_3288.color)) && color_mode != -1)
// {
// printf("color_mode111111111111111111111 =%d\r\n",color_mode);
// dsp_config.params_3288.color ^= 1;
// //ret = writedown_device_configuration();
// printf("on_color_mode_changed ret =%d\r\n",ret);
// if(ret)
// dsp_config.params_3288.color ^= 1;
// }
if (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY)
{
dsp_config.params_3288.isColor = 0;
}
else if(color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH)
{
dsp_config.params_3288.isColor = 1;
}
setting_hardware::HGSCANCONF_3288 d = dsp_config;
if(image_prc_param_.bits.rid_color != RID_COLOR_NONE && image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY && color_mode == -1)
{
dsp_config.params_3288.isColor = 1;
}
else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE && image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY && color_mode == -1)
{
dsp_config.params_3288.isColor = 0;
}
if(color_mode == -1)
ret = writedown_device_configuration(true);
return ret;
dsp_config.params_3288.isColor = (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY) ? 0 : 1;
return SCANNER_ERR_OK;
}
int hg_scanner_400::on_paper_changed(int& paper)
{
@ -547,6 +528,35 @@ int hg_scanner_400::initdevice()
void hg_scanner_400::writedown_image_configuration(void)
{
SCANCONF ic;
int len = sizeof(ic);
bzero(&ic, len);
ic.contrast = contrast_;
ic.brightness = bright_;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = 1;
}
else
ic.scannum = scan_count_;
ic.en_sizecheck = dsp_config.params_3288.enableSizeDetect;
ic.hardwarecaps.en_skrewdetect = 0;
ic.hardwarecaps.en_doublefeed = dsp_config.params_3288.doubleFeeded;
ic.hardwarecaps.en_stapledetect = 0;
ic.hardwarecaps.skrewdetectlevel = 0;
// ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper;
ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
image_configuration(ic);
//int ret = agreement((TwSS)img_conf_.papertype, img_conf_.paperAlign);
/*SCANCONF ic;
ic.papertype = paper_size_;
@ -774,7 +784,7 @@ void hg_scanner_400::writedown_image_configuration(void)
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ", ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%f\r\n ", ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
*/
}
void hg_scanner_400::printf_devconfig(setting_hardware::HGSCANCONF_3288 *d)

View File

@ -415,19 +415,26 @@ int hg_scanner_402::get_device_paperon_stautus(void)
// return ret;
// }
int hg_scanner_402::writedown_device_configuration(setting_hardware::HGSCANCONF_3399 *dev_conf)
int hg_scanner_402::writedown_device_configuration(bool type, setting_hardware::HGSCANCONF_3399* dev_conf)
{
int ret = SCANNER_ERR_OK;
if (!type)
return ret;
if (!dev_conf)
{
dev_conf_.params_3399.is_textcorrect = !keep_watermark_;
dev_conf = &dev_conf_;
if (image_prc_param_.bits.rid_color != RID_COLOR_NONE
&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE))
}
if (is_multiout)
{
dev_conf->params_3399.color = image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW ? 0 : 1;
}
else if ((image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY
|| image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)
&& image_prc_param_.bits.rid_color != RID_COLOR_NONE)
{
dev_conf->params_3399.color = 1;
}
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
|| image_prc_param_.bits.paper == PAPER_MAX_SIZE
|| image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
@ -457,6 +464,42 @@ int hg_scanner_402::writedown_image_configuration(void)
bzero(&ic, len);
ic.en_sizecheck = dev_conf_.params_3399.enable_sizecheck;
ic.hardwarecaps.en_skrewdetect = dev_conf_.params_3399.screw_detect_enable;
ic.hardwarecaps.en_doublefeed = dev_conf_.params_3399.ultrasonic_enable;
ic.hardwarecaps.en_stapledetect = dev_conf_.params_3399.staple_enbale;
ic.hardwarecaps.skrewdetectlevel = dev_conf_.params_3399.screw_detect_level;
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = /*ic.is_duplex ? 2 :*/ 1;
}
else
{
if (scan_count_ == -1)
ic.scannum = -1;
else
ic.scannum = (ic.is_duplex ? scan_count_ * 2 : scan_count_);
}
ic.contrast = (contrast_ - 4) * 333.0;
ic.brightness = (bright_ - 128) * (2000.0 / 254.0);
image_configuration(ic);
{
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->write_bulk(&ic, &len);
this_thread::sleep_for(chrono::milliseconds(500));
io_->set_timeout(2000);//必要延时
}
/*int ret = SCANNER_ERR_OK;
SCANCONF ic;
int len = sizeof(ic);
bzero(&ic, len);
ic.papertype = paper_size_;
if (is_lateral(image_prc_param_.bits.paper))
@ -527,7 +570,7 @@ int hg_scanner_402::writedown_image_configuration(void)
if (test_1_paper_)
{
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = /*ic.is_duplex ? 2 :*/ 1;
ic.scannum = //ic.is_duplex ? 2 :// 1;
}
else
{
@ -698,6 +741,7 @@ int hg_scanner_402::writedown_image_configuration(void)
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
img_conf_ = ic;
*/
return ret;
}
@ -1225,8 +1269,14 @@ int hg_scanner_402::start(void)
return SCANNER_ERR_DEVICE_NO_PAPER;
}
notify_ui_working_status(STATU_DESC_REWRITE_CONFIGURATION);
writedown_device_configuration();
ret = writedown_device_configuration(true);
if (ret == SCANNER_ERR_OK)
writedown_image_configuration();
else
{
status_ = ret;
return ret;
}
val = 0;
ret = read_register(/*SR_GET_ANDROID_STATE*/0x1001, &val);

View File

@ -47,7 +47,7 @@ class hg_scanner_402 : public hg_scanner
int get_device_sleep_stautus(void);
int get_device_paperon_stautus(void);
int writedown_device_configuration(setting_hardware::HGSCANCONF_3399 *dev_conf = NULL);
int writedown_device_configuration(bool type = false, setting_hardware::HGSCANCONF_3399* dev_conf = NULL);
int writedown_image_configuration(void);
int pop_first_image(void);

View File

@ -783,9 +783,9 @@ namespace hg_imgproc
std::vector<cv::Mat> mats(mats_);
mats_.clear();
SIZE temp_Size = papersize_.GetPaperSize(img_conf_.papertype,200,img_conf_.paperAlign);
SIZE temp_Size = papersize_.GetPaperSize(img_conf_.papertype, img_conf_.resolution_dst,img_conf_.paperAlign);
cv::Size cvSize(temp_Size.cx, temp_Size.cy);
CImageApplyAutoCrop crop(img_conf_.is_autocrop,img_conf_.autodescrew,img_conf_.fillbackground,cvSize,img_conf_.is_convex,img_conf_.isfillcolor);
CImageApplyAutoCrop crop(img_conf_.is_autocrop, img_conf_.autodescrew, img_conf_.fillbackground, cvSize, true, false, 40, 8, 5, false, false);
crop.apply(mats,img_conf_.is_duplex);
mats_ = mats;