调整穿孔移除

This commit is contained in:
13038267101 2022-09-12 12:57:23 +08:00
parent 934c94030a
commit 8b55340540
2 changed files with 28 additions and 22 deletions

View File

@ -2356,6 +2356,7 @@ int hg_scanner::save_final_image(hg_imgproc::LPIMGHEAD head, void* buf)
}
void hg_scanner::adjust_filling_hole(LPSCANCONF conf)
{
int maxval = 0;
#define SET_FILL_HOLE(member, me) \
conf->fillholeratio_##member = isremove_##me##_hole ? isremove_##me##_hole_threshold * 100 + .5f : 0; \
@ -2370,7 +2371,14 @@ void hg_scanner::adjust_filling_hole(LPSCANCONF conf)
SET_FILL_HOLE(down, low);
SET_FILL_HOLE(left, left);
SET_FILL_HOLE(right, right);
if (!isremove_left_hole)
conf->fillholeratio_left = 0;
if (!isremove_right_hole)
conf->fillholeratio_right = 0;
if (!isremove_top_hole)
conf->fillholeratio_up = 0;
if (!isremove_low_hole)
conf->fillholeratio_down = 0;
if (maxval)
{
conf->fillhole.is_fillhole = true;

View File

@ -682,26 +682,8 @@ void hg_scanner_239::image_process(std::shared_ptr<tiny_buffer>& buff)
err = hg_imgproc::load_buffer(handle, buff);
err = hg_imgproc::decode(handle,pid_);
if (!isremove_left_hole)
{
isremove_top_hole_threshold = 0;
}
if (!isremove_right_hole)
{
isremove_right_hole_threshold = 0;
}
if (!isremove_top_hole)
{
isremove_top_hole_threshold = 0;
}
if (!isremove_low_hole)
{
isremove_low_hole_threshold = 0;
}
if (isremove_left_hole || isremove_right_hole || isremove_top_hole || isremove_low_hole)
{
err = hg_imgproc::fillhole(handle, isremove_top_hole_threshold, isremove_low_hole_threshold, isremove_left_hole_threshold, isremove_right_hole_threshold);
}
if(image_prc_param_.bits.erase_bakground)
{
err = hg_imgproc::fadeback(handle,img_conf_.fadebackrange,img_conf_.is_duplex);
@ -926,7 +908,6 @@ int hg_scanner_239::writedown_image_configuration(void)
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;
@ -952,6 +933,23 @@ int hg_scanner_239::writedown_image_configuration(void)
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);
if (!isremove_left_hole)
{
ic.fillholeratio_left = 0;
}
if (!isremove_right_hole)
{
ic.fillholeratio_right = 0;
}
if (!isremove_top_hole)
{
ic.fillholeratio_up = 0;
}
if (!isremove_low_hole)
{
ic.fillholeratio_down = 0;
}
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)