From 35999b8f160419b17daf6585c572ddddc52a72c4 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Tue, 5 Dec 2023 15:51:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A3=81=E5=88=87?= =?UTF-8?q?=E7=BA=A0=E5=81=8F=E7=AE=97=E6=B3=95=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=B9=85=E9=9D=A2=E8=A3=81=E5=88=87=E7=BA=A0?= =?UTF-8?q?=E5=81=8F=E4=BD=8D=E7=BD=AE=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/ImageProcess/ImageApplyAutoCrop.cpp | 63 ++------------------ hgdriver/ImageProcess/ImageApplyAutoCrop.h | 5 +- 2 files changed, 8 insertions(+), 60 deletions(-) diff --git a/hgdriver/ImageProcess/ImageApplyAutoCrop.cpp b/hgdriver/ImageProcess/ImageApplyAutoCrop.cpp index 0a48e2b..20976a7 100644 --- a/hgdriver/ImageProcess/ImageApplyAutoCrop.cpp +++ b/hgdriver/ImageProcess/ImageApplyAutoCrop.cpp @@ -96,59 +96,6 @@ void CImageApplyAutoCrop::myWarpAffine(cv::InputArray _src, cv::OutputArray _dst M, interpolation, borderType, borderValue.val); } -cv::Scalar CImageApplyAutoCrop::getBackGroudColor(const cv::Mat& image) -{ - if (image.channels() == 3) - { - uchar table[768] = { 0 }; - int hist_bgr[3][256] = { 0 }; - int width = image.cols, height = image.rows, bytesPerLine = image.step; - memset(table, 255, 768); - - unsigned char* ptr_data = image.data; - unsigned char b = 0; - for (uint i = 0; i < height; i++, ptr_data += bytesPerLine) - for (uint j = 0, x = 0; j < width; j++, x += 3) - { - b = table[ptr_data[x] + ptr_data[x + 1] + ptr_data[x + 2]]; - for (uint k = 0; k < 3; k++) - hist_bgr[k][ptr_data[x + k] & b]++; - } - - int max_vals[3] = { 0 }; - cv::Scalar max_indexes(0, 0, 0); - - for (uint i = 5; i < 256; i++) - for (uint j = 0; j < 3; j++) - if (hist_bgr[j][i] > max_vals[j]) - { - max_vals[j] = hist_bgr[j][i]; - max_indexes[j] = i; - } - - return max_indexes; - } - else - { - uchar table[256] = { 0 }; - int hist_bgr[256] = { 0 }; - int width = image.cols, height = image.rows, bytesPerLine = image.step; - memset(table, 255, 256); - unsigned char* ptr_data = image.data; - unsigned char b = 0; - for (uint i = 0; i < height; i++, ptr_data += bytesPerLine) - for (uint j = 0, x = 0; j < width; j++, x ++) - hist_bgr[ptr_data[x] & table[ptr_data[x]]]++; - - int max_vals = 5; - for (uint i = 5; i < 256; i++) - if (hist_bgr[i] > hist_bgr[max_vals]) - max_vals = i; - - return cv::Scalar(max_vals); - } -} - void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst, bool isAutoCrop, bool isDesaskew, bool isFillBlank, int dWidth, int dHeight, bool isConvex, bool isColorBlank, double threshold, int noise, int indent, bool isNormalCrop, double fx, double fy) { @@ -226,7 +173,9 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst boudingRect.width *= FX_FY; boudingRect.height *= FX_FY; - blankColor = getBackGroudColor(resizeMat(boudingRect)); + cv::Mat temp_bgc; + cv::resize(resizeMat(boudingRect), temp_bgc, cv::Size(200, 200)); + blankColor = hg::getBackGroundColor(temp_bgc, cv::Mat(), threshold); } else blankColor = cv::Scalar::all(255); @@ -254,9 +203,9 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst int h = rect.size.height; int x = (dst.cols - w) / 2; int y = (dst.rows - h) / 2; - dstTri[0] = cv::Point2f(0, h); - dstTri[1] = cv::Point2f(0, 0); - dstTri[2] = cv::Point2f(w, 0); + dstTri[0] = cv::Point2f(x, y + h); + dstTri[1] = cv::Point2f(x, y); + dstTri[2] = cv::Point2f(x + w, y); dstROI = dst(cv::Rect(x, y, w, h) & cv::Rect(0, 0, dst.cols, dst.rows)); myWarpAffine(src, dstROI, cv::getAffineTransform(srcTri, dstTri), dstROI.size(), cv::INTER_LINEAR, cv::BORDER_CONSTANT, cv::Scalar::all(0)); diff --git a/hgdriver/ImageProcess/ImageApplyAutoCrop.h b/hgdriver/ImageProcess/ImageApplyAutoCrop.h index 8c749cd..1f68256 100644 --- a/hgdriver/ImageProcess/ImageApplyAutoCrop.h +++ b/hgdriver/ImageProcess/ImageApplyAutoCrop.h @@ -34,7 +34,8 @@ 2023/05/15 v1.5.5 优化文稿背景色识别算法。 2023/05/23 v1.5.6 修复纯黑图找不到外界轮廓会导致崩溃的BUG。 2023/11/02 v1.6 优化抗噪能力。采用自适应背景色二值化。 - * 版本号:v1.5.6 + 2023/12/05 v1.6.1 替换获取背景色方案;修复固定幅面裁切纠偏的坐标计算BUG。 + * 版本号:v1.6.1 * ==================================================== */ @@ -115,8 +116,6 @@ public: private: static void myWarpAffine(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _M0, cv::Size dsize, int flags, int borderType, const cv::Scalar& borderValue); - - static cv::Scalar getBackGroudColor(const cv::Mat& image); private: bool m_isCrop; bool m_isDesaskew; From 57de6617b4638f8ef16b680ccc3759680fd53806 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Tue, 5 Dec 2023 16:58:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BD=A9=E6=97=97?= =?UTF-8?q?=E7=BA=A0=E5=81=8F=E7=AE=97=E6=B3=95=E9=98=88=E5=80=BC=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AD=98=E5=9C=A8rgb=E5=9D=87=E5=80=BC?= =?UTF-8?q?=E4=BD=8E=E4=BA=8E=E8=AF=A5=E9=98=88=E5=80=BC=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=A3=81=E5=88=87=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/image_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hgdriver/hgdev/image_process.cpp b/hgdriver/hgdev/image_process.cpp index bfc3aca..dc0b3e1 100644 --- a/hgdriver/hgdev/image_process.cpp +++ b/hgdriver/hgdev/image_process.cpp @@ -842,7 +842,7 @@ namespace hg_imgproc SIZE temp_Size = papersize_.GetPaperSize(img_conf_.papertype, dpi,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,img_conf_.is_convex,img_conf_.isfillcolor, 30); crop.apply(mats,img_conf_.is_duplex); mats_ = mats; From 27fa305c9adfd4a65349073bd8ee4c8623c081af Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 6 Dec 2023 09:10:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0pop=5Ffirst=5Fimage?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner_200.cpp | 11 ++++++-- hgdriver/hgdev/hg_scanner_300.cpp | 39 ++++++++++++++----------- hgdriver/hgdev/hg_scanner_302.cpp | 5 +++- hgdriver/hgdev/hg_scanner_306.cpp | 47 +++++++++++++++++-------------- 4 files changed, 61 insertions(+), 41 deletions(-) diff --git a/hgdriver/hgdev/hg_scanner_200.cpp b/hgdriver/hgdev/hg_scanner_200.cpp index 9b5679e..a7f0edc 100644 --- a/hgdriver/hgdev/hg_scanner_200.cpp +++ b/hgdriver/hgdev/hg_scanner_200.cpp @@ -81,6 +81,7 @@ namespace settingsdsp_200 } hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io,pid) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_200(%s) constructing ...\n", hg_log::format_ptr(this).c_str()); //pid_ = pid; initdevice(); @@ -370,12 +371,18 @@ int hg_scanner_200::readusb(USBCB &usb) } int hg_scanner_200::pop_image() { - std::lock_guard lock(io_lock_); int ret = SCANNER_ERR_OK; USBCB usbcb = { setting3288dsp::POP_IMAGE, 0, 0 }; - ret = writeusb(usbcb); + { + std::lock_guard lock(io_lock_); + ret = writeusb(usbcb); + } + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } diff --git a/hgdriver/hgdev/hg_scanner_300.cpp b/hgdriver/hgdev/hg_scanner_300.cpp index 41d660a..a5ebfd3 100644 --- a/hgdriver/hgdev/hg_scanner_300.cpp +++ b/hgdriver/hgdev/hg_scanner_300.cpp @@ -87,8 +87,9 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : ,papersize(pid) ,is_devs_sleep_(false) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_300(%s) constructing ...\n", hg_log::format_ptr(this).c_str()); dsp_config.value = 0; - dsp_config.params_3288.enableLed = 1; //默认值 + dsp_config.params_3288.enableLed = 1; //默认? dsp_config.params_3288.isCorrect = 1; int ret = initdevice(); @@ -117,7 +118,7 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : firmware_sup_log_export_G300_ = year_date.compare("230430") >= 0 ? true : false; #ifndef MAPPING_FUNCTION_IN_BASE - init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化 + init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始? #endif if (init_settings(pid_)) @@ -158,11 +159,11 @@ void hg_scanner_300::thread_handle_usb_read(void) } //printf("usb.u32_Data = %d ret = %d\r\n",usb.u32_Data,ret); - //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止。 所以始终以 "停止" 消息为结束信号 - //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来。 + //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止?所以始终以 "停止" 消息为结束信? + //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来? if (ret == SCANNER_ERR_DEVICE_STOPPED) { - status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为准 + status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为? savestatus_.clear(); if (user_cancel_) { @@ -239,7 +240,7 @@ void hg_scanner_300::thread_handle_usb_read(void) VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s\n", hg_scanner_err_description(status_)); break; } - if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡死 + if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡? { if ((img_conf_.papertype == TwSS::MaxSize || img_conf_.papertype == TwSS::USStatement) && pid_ == 0x0300 && firmware_sup_dpi_600) { @@ -247,30 +248,30 @@ void hg_scanner_300::thread_handle_usb_read(void) } else { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "Get Status TimeOut,get image out 30S\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } } if (sw.elapsed_s() > 130) { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "MaxSize TimeOut,Get Image 130s\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } if (ret == SCANNER_ERR_OK && usb.u32_Count > 0) { - int totalNum = usb.u32_Count & 0x3fffffff; // 2022-08-04: 兼容Android,默认图片大小均在1GB以内 + int totalNum = usb.u32_Count & 0x3fffffff; // 2022-08-04: 兼容Android,默认图片大小均?GB以内 VLOG_MINI_2(LOG_LEVEL_WARNING, "Get Scaner Image Size:%d bytes,Image Num[%d]\n", totalNum,img_num); img_num++; if (totalNum) @@ -381,7 +382,7 @@ int hg_scanner_300::do_start(void) { return ret; } - if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险) + if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险? { is_devs_sleep_ = false; set_kernelsnap_ver(); @@ -476,6 +477,10 @@ int hg_scanner_300::pop_image() std::lock_guard lock(io_lock_); ret = writeusb(usbcb); } + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } @@ -802,7 +807,7 @@ int hg_scanner_300::initdevice() if (status_ != SCANNER_ERR_DEVICE_SLEEPING) { set_kernelsnap_ver(); - is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本号 还没有做判断的 + is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本?还没有做判断? } return status_; } @@ -834,7 +839,7 @@ void hg_scanner_300::writedown_image_configuration(void) // ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper; ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型 - ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用 + ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使? image_configuration(ic); } void hg_scanner_300::printf_devconfig(setting_hardware::HGSCANCONF_3288 *d) @@ -975,7 +980,7 @@ int hg_scanner_300::get_correction_image(int inx , int dpi, int mode) cv::Mat white_mat; cv::Mat black_mat;; - for (size_t i = 0; i < 2; i++) //黑白一起保存下来 + for (size_t i = 0; i < 2; i++) //黑白一起保存下? { vector imagedata; @@ -1017,7 +1022,7 @@ int hg_scanner_300::get_correction_image(int inx , int dpi, int mode) if (mat.empty()) { VLOG_MINI_1(LOG_LEVEL_WARNING, "get_correction_image image is NULL:%d\n", image_info.info.params.status); - return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退了 + return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退? } float f = 0.0; @@ -1050,7 +1055,7 @@ std::string hg_scanner_300::get_firmware_version() { char buf[20] = { 0 }; int ret = SCANNER_ERR_OK, - len = 10; //协议定义长度为10 100 200 =8 + len = 10; //协议定义长度?0 100 200 =8 USBCB cmd = { setting3288dsp::GET_FW_VERSION,len,0,}; { diff --git a/hgdriver/hgdev/hg_scanner_302.cpp b/hgdriver/hgdev/hg_scanner_302.cpp index b426936..efaecb1 100644 --- a/hgdriver/hgdev/hg_scanner_302.cpp +++ b/hgdriver/hgdev/hg_scanner_302.cpp @@ -550,7 +550,10 @@ int hg_scanner_302::pop_first_image(void) std::lock_guard lock(io_lock_); int ret = write_register(setting3399::SR_IM_POP, 1); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner_err_name(ret)); + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_first_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } diff --git a/hgdriver/hgdev/hg_scanner_306.cpp b/hgdriver/hgdev/hg_scanner_306.cpp index 0b00047..1183255 100644 --- a/hgdriver/hgdev/hg_scanner_306.cpp +++ b/hgdriver/hgdev/hg_scanner_306.cpp @@ -82,8 +82,9 @@ hg_scanner_306::hg_scanner_306(const char* dev_name,int pid, usb_io* io) : , frame_width_(0) , frame_hegiht_(0) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_306(%s) constructing ...\n", hg_log::format_ptr(this).c_str()); dsp_config.value = 0; - dsp_config.params_7010.enableLed = 1; //默认值 + dsp_config.params_7010.enableLed = 1; //默认? dsp_config.params_7010.isCorrect = 1; int ret = get_device_type(firmware_sup_device_7010); @@ -100,7 +101,7 @@ hg_scanner_306::hg_scanner_306(const char* dev_name,int pid, usb_io* io) : } #ifndef MAPPING_FUNCTION_IN_BASE - init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化 + init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始? #endif if (init_settings(pid_)) init_settings((jsontext1 + jsontext2 + jsontext3).c_str()); @@ -135,11 +136,11 @@ void hg_scanner_306::thread_handle_usb_read(void) } //printf("usb.u32_Data = %d ret = %d\r\n",usb.u32_Data,ret); - //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止。 所以始终以 "停止" 消息为结束信号 - //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来。 + //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止?所以始终以 "停止" 消息为结束信? + //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来? if (ret == SCANNER_ERR_DEVICE_STOPPED) { - status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为准 + status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为? savestatus_.clear(); if (user_cancel_) { @@ -216,7 +217,7 @@ void hg_scanner_306::thread_handle_usb_read(void) VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s\n", hg_scanner_err_description(status_)); break; } - if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡死 + if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡? { if ((img_conf_.papertype == TwSS::MaxSize || img_conf_.papertype == TwSS::USStatement) && pid_ == 0x0300 && firmware_sup_dpi_600) { @@ -224,25 +225,25 @@ void hg_scanner_306::thread_handle_usb_read(void) } else { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "Get Status TimeOut,get image out 30S\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } } if (sw.elapsed_s() > 130) { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "MaxSize TimeOut,Get Image 130s\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } if (ret == SCANNER_ERR_OK && usb.u32_Count > 0) @@ -337,7 +338,7 @@ int hg_scanner_306::do_start(void) { return ret; } - if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险) + if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险? { is_devs_sleep_ = false; set_kernelsnap_ver(); @@ -432,6 +433,10 @@ int hg_scanner_306::pop_image() std::lock_guard lock(io_lock_); ret = writeusb(usbcb); } + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } @@ -758,7 +763,7 @@ int hg_scanner_306::initdevice() if (status_ != SCANNER_ERR_DEVICE_SLEEPING) { set_kernelsnap_ver(); - is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本号 还没有做判断的 + is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本?还没有做判断? } return SCANNER_ERR_OK; } @@ -790,7 +795,7 @@ void hg_scanner_306::writedown_image_configuration(void) // ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper; ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型 - ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用 + ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使? image_configuration(ic); } void hg_scanner_306::printf_devconfig(setting_hardware::HGSCANCONF_7010 *d) @@ -870,7 +875,7 @@ int hg_scanner_306::get_correction_image(int inx , int dpi, int mode) cv::Mat white_mat; cv::Mat black_mat;; - for (size_t i = 0; i < 2; i++) //黑白一起保存下来 + for (size_t i = 0; i < 2; i++) //黑白一起保存下? { vector imagedata; @@ -908,7 +913,7 @@ int hg_scanner_306::get_correction_image(int inx , int dpi, int mode) if (mat.empty()) { VLOG_MINI_1(LOG_LEVEL_WARNING, "get_correction_image image is NULL:%d\n", image_info.info.params.status); - return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退了 + return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退? } float f = 0.0; @@ -934,7 +939,7 @@ std::string hg_scanner_306::get_firmware_version() { char buf[20] = { 0 }; int ret = SCANNER_ERR_OK, - len = 10; //协议定义长度为10 100 200 =8 + len = 10; //协议定义长度?0 100 200 =8 USBCB cmd = { setting3288dsp::GET_FW_VERSION,len,0,}; { @@ -1221,13 +1226,13 @@ int hg_scanner_306::set_scan_lock_check_val(string str) } //#enum scanner_err //#{ -//# SCANNER_ERR_OK = 0, //设备正常状态 +//# SCANNER_ERR_OK = 0, //设备正常状? //# SCANNER_ERR_SLEEP, 1 //设备处于休眠当中 -//# SCANNER_ERR_UPDATE_OK, 2 //设备更新:成功 +//# SCANNER_ERR_UPDATE_OK, 2 //设备更新:成? //# SCANNER_ERR_UPDATE_UPDATAING, 3 //设备更新:进行中 -//# SCANNER_ERR_UPDATE_CHECK_VAL_ERROR, 4 //设备更新:校验检测错误 -//# SCANNER_ERR_UPDATE_CHECK_FILE_LOST, 5 //设备更新:文件丢失 -//# SCANNER_ERR_UPDATE_UNZIP_FAIL, 6 //设备更新:解压失败 +//# SCANNER_ERR_UPDATE_CHECK_VAL_ERROR, 4 //设备更新:校验检测错? +//# SCANNER_ERR_UPDATE_CHECK_FILE_LOST, 5 //设备更新:文件丢? +//# SCANNER_ERR_UPDATE_UNZIP_FAIL, 6 //设备更新:解压失? //#}; int hg_scanner_306::set_firmware_upgrade(std::string str) {