添加自定义裁切

This commit is contained in:
mo1027728827@qq.com 2022-05-06 17:34:17 +08:00
parent 89b46cc387
commit 3fc874b5fa
3 changed files with 35 additions and 22 deletions

View File

@ -4,9 +4,9 @@ sys=${sys%% *}
echo "------------------------------change cmake path:$1--------------------" echo "------------------------------change cmake path:$1--------------------"
if [ "$sys" == "UnionTech" ];then if [ "$sys" == "UnionTech" ];then
sed -i "s/kylin/$1/g" hgdriver/wrapper/CMakeLists.txt sed -i "s/kylin/uos/g" hgdriver/wrapper/CMakeLists.txt
elif [ "$sys" == "kylin" ];then elif [ "$sys" == "kylin" ];then
sed -i "s/uos/$1/g" hgdriver/wrapper/CMakeLists.txt sed -i "s/uos/kylin/g" hgdriver/wrapper/CMakeLists.txt
fi fi
cd ../ cd ../

View File

@ -1378,7 +1378,7 @@ int hg_scanner::setting_custom_area_left(void* data)
{ {
SANE_Fixed* v = (SANE_Fixed*)data; SANE_Fixed* v = (SANE_Fixed*)data;
custom_area_lt_x_ = SANE_UNFIX(*v); custom_area_lt_x_ = *((double*)data);
return HG_ERR_OK; return HG_ERR_OK;
} }
@ -1386,7 +1386,7 @@ int hg_scanner::setting_custom_area_top(void* data)
{ {
SANE_Fixed* v = (SANE_Fixed*)data; SANE_Fixed* v = (SANE_Fixed*)data;
custom_area_lt_y_ = SANE_UNFIX(*v); custom_area_lt_y_ = *((double*)data);
return HG_ERR_OK; return HG_ERR_OK;
} }
@ -1394,7 +1394,7 @@ int hg_scanner::setting_custom_area_right(void* data)
{ {
SANE_Fixed* v = (SANE_Fixed*)data; SANE_Fixed* v = (SANE_Fixed*)data;
custom_area_br_x_ = SANE_UNFIX(*v); custom_area_br_x_ = *((double*)data);
return HG_ERR_OK; return HG_ERR_OK;
} }
@ -1402,7 +1402,8 @@ int hg_scanner::setting_custom_area_bottom(void* data)
{ {
SANE_Fixed* v = (SANE_Fixed*)data; SANE_Fixed* v = (SANE_Fixed*)data;
custom_area_br_y_ = SANE_UNFIX(*v); custom_area_br_y_ = *((double*)data);
return HG_ERR_OK; return HG_ERR_OK;
} }

View File

@ -413,14 +413,15 @@ int hg_scanner_200::start(void)
} }
printf_devconfig(); printf_devconfig();
ret = get_scan_is_sleep(); //writedown_device_configuration(true);
if (ret == HG_ERR_DEVICE_SLEEPING) // ret = get_scan_is_sleep();
{ // if (ret == HG_ERR_DEVICE_SLEEPING)
status_ = ret; // {
notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_SLEEPING, SANE_EVENT_SCAN_FINISHED, status_); // status_ = ret;
HG_VLOG_MINI_1(HG_LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_HG_ERR_DEVICE_SLEEPING); // notify_ui_working_status(STATU_DESC_HG_ERR_DEVICE_SLEEPING, SANE_EVENT_SCAN_FINISHED, status_);
return ret; // HG_VLOG_MINI_1(HG_LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_HG_ERR_DEVICE_SLEEPING);
} // return ret;
// }
ret = get_scanner_paperon(); ret = get_scanner_paperon();
if (ret == HG_ERR_DEVICE_NO_PAPER) if (ret == HG_ERR_DEVICE_NO_PAPER)
{ {
@ -621,7 +622,7 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
if (img_conf_.cropRect.enable && !img_conf_.is_autocrop) if (img_conf_.cropRect.enable && !img_conf_.is_autocrop)
{ {
hg_imgproc::croprect(handle); hg_imgproc::croprect(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"手动裁图开启\r\n"); //printf("手动裁图开启\r\n");
} }
if (img_conf_.filter != ColorFilter::FILTER_NONE && (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY)) if (img_conf_.filter != ColorFilter::FILTER_NONE && (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY))
{ {
@ -650,7 +651,7 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
if ((img_conf_.is_autotext != TEXT_DIRECTION_0 || img_conf_.is_backrotate180) && (img_conf_.is_autotext != TEXT_DIRECTION_AUTO)) if ((img_conf_.is_autotext != TEXT_DIRECTION_0 || img_conf_.is_backrotate180) && (img_conf_.is_autotext != TEXT_DIRECTION_AUTO))
{ {
hg_imgproc::orentation(handle); hg_imgproc::orentation(handle);
printf("img_conf_ =%d 自动旋转开启\r\n",img_conf_.is_autotext); //printf("img_conf_ =%d 自动旋转开启\r\n",img_conf_.is_autotext);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"自动旋转开启\r\n"); //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"自动旋转开启\r\n");
} }
if (img_conf_.removeMorr) if (img_conf_.removeMorr)
@ -1017,7 +1018,6 @@ void hg_scanner_200::writedown_image_configuration(void)
ic.detachnoise.is_detachnoise = image_prc_param_.bits.noise_optimize; ic.detachnoise.is_detachnoise = image_prc_param_.bits.noise_optimize;
ic.detachnoise.detachnoise = noise_range_; ic.detachnoise.detachnoise = noise_range_;
printf("image_prc_param_.bits.text_direction = %d\r\n",image_prc_param_.bits.text_direction);
ic.is_autotext = image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO ? 1 :image_prc_param_.bits.text_direction; ic.is_autotext = image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO ? 1 :image_prc_param_.bits.text_direction;
@ -1028,11 +1028,17 @@ void hg_scanner_200::writedown_image_configuration(void)
ic.errorExtention = image_prc_param_.bits.error_extention ;//暂无参数 ic.errorExtention = image_prc_param_.bits.error_extention ;//暂无参数
ic.textureRemove = image_prc_param_.bits.remove_txtture;//暂无参数 ic.textureRemove = image_prc_param_.bits.remove_txtture;//暂无参数
ic.splitImage = image_prc_param_.bits.split; ic.splitImage = image_prc_param_.bits.split;
ic.cropRect.enable = 0;//暂无参数
ic.cropRect.height = 0;//暂无参数 //custom_area_br_x_ *ic.resolution_dst /25.4;
ic.cropRect.width = 0;//暂无参数 //custom_area_br_y_ *ic.resolution_dst /25.4;
ic.cropRect.x = 0;//暂无参数
ic.cropRect.y = 0;//暂无参数 ic.cropRect.enable = custom_area_;
ic.cropRect.height = custom_area_br_y_ *ic.resolution_dst /25.4;
ic.cropRect.width = custom_area_br_x_ *ic.resolution_dst /25.4;
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::Unused; //暂无参数 ic.multiOutput = MultiOutput::Unused; //暂无参数
ic.normalCrop = image_prc_param_.bits.dark_sample; ic.normalCrop = image_prc_param_.bits.dark_sample;
ic.dogeardistabce = fractate_level_; ic.dogeardistabce = fractate_level_;
@ -1102,6 +1108,12 @@ void hg_scanner_200::writedown_image_configuration(void)
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole); HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio); HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback); HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
} }
void hg_scanner_200::printf_devconfig(HGSCANCONF_DSP *d) void hg_scanner_200::printf_devconfig(HGSCANCONF_DSP *d)
{ {