From e848aabd4a752024746621e1b8f3df14d59de85a Mon Sep 17 00:00:00 2001 From: masayume <1936714878@qq.com> Date: Sat, 10 Apr 2021 10:36:03 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=89=E4=BF=AE=E6=94=B9=E8=83=8C=E9=9D=A21?= =?UTF-8?q?80=C2=B0=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98=E3=80=82?= =?UTF-8?q?=202)=20=E4=BF=AE=E6=94=B9usb=E5=BA=95=E5=B1=82=E5=BA=93?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E5=AE=89=E5=8D=93=E6=9C=BAusb=E8=BF=9E=E6=8E=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- huagao/Device/GScanO200.cpp | 2 +- huagao/Device/GScanO400.cpp | 2 +- huagao/Device/ImageMatQueue.cpp | 6 +++--- huagao/Device/UsbScanEx.cpp | 18 ++++++------------ huagao/Device/filetools.h | 17 +++++++++++++++++ huagao/ImageProcess/ImageApplyRotation.cpp | 12 ++---------- huagao/stdafx.h | Bin 10720 -> 10716 bytes 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/huagao/Device/GScanO200.cpp b/huagao/Device/GScanO200.cpp index 2720a855..ebeb10d1 100644 --- a/huagao/Device/GScanO200.cpp +++ b/huagao/Device/GScanO200.cpp @@ -582,7 +582,7 @@ void GScanO200::usbmain() } } else { - if (m_pImages->orginimgcount() > 15) + if (m_pImages->orginimgcount() > 10) { this_thread::sleep_for(chrono::milliseconds(10)); continue; diff --git a/huagao/Device/GScanO400.cpp b/huagao/Device/GScanO400.cpp index c195a151..e9739796 100644 --- a/huagao/Device/GScanO400.cpp +++ b/huagao/Device/GScanO400.cpp @@ -576,7 +576,7 @@ void GScanO400::usbmain() } } else { - if (m_pImages->orginimgcount() > 15) { + if (m_pImages->orginimgcount() > 10) { this_thread::sleep_for(chrono::milliseconds(10)); continue; } diff --git a/huagao/Device/ImageMatQueue.cpp b/huagao/Device/ImageMatQueue.cpp index 0126f8b3..f155f59f 100644 --- a/huagao/Device/ImageMatQueue.cpp +++ b/huagao/Device/ImageMatQueue.cpp @@ -162,6 +162,9 @@ void ImageMatQueue::setparam(const GScanCap& param) fixedSize = papersize.GetPaperSize(param.papertype, 200.0f, param.paperAlign); #endif m_iaList.push_back(shared_ptr(new CImageApplyAutoCrop(islongcustomcrop ? islongcustomcrop : param.is_autocrop, param.autodescrew, param.fillbackground, cv::Size(fixedSize.cx, fixedSize.cy), param.is_convex,false,param.AutoCrop_threshold,param.noise,param.indent))); + //m_iaList.push_back(shared_ptr(new CImageApplyAutoCrop(true, param.autodescrew, param.fillbackground, cv::Size(fixedSize.cx, fixedSize.cy), param.is_convex, false, param.AutoCrop_threshold, param.noise, param.indent))); + //if(!islongcustomcrop) + // m_iaList.push_back(shared_ptr(new CImageApplyResize(CImageApplyResize::ResizeType::DSIZE, cv::Size(fixedSize.cx, fixedSize.cy), 1.0, 1.0))); } if (param.is_autodiscradblank_normal || param.is_autodiscradblank_vince) { //m_iaList.push_back(shared_ptr(new CImageApplyDiscardBlank())); @@ -376,15 +379,12 @@ void ImageMatQueue::imageproceing(std::vector> mats.push_back(mat); mat.release(); #else // G200 - //resize(mat, mat, cv::Size(), 1.001, 1.0070);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动 - //cv::imwrite("D:\\org"+to_string(++index)+".jpg", mat); Mat front = mat(Rect(0, 0, mat.cols / 2, mat.rows)); Mat back = mat(Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows)); if (scanParam.imageRotateDegree != 0.0 && scanParam.imageRotateDegree != 180.0) { cv::flip(front, front, 0); cv::flip(front, front, 1); } - //FileTools::write_log("scanParam.imageRotateDegree-" + to_string(scanParam.imageRotateDegree)); mats.push_back(back); mats.push_back(front); #endif diff --git a/huagao/Device/UsbScanEx.cpp b/huagao/Device/UsbScanEx.cpp index 511395b4..ad828780 100644 --- a/huagao/Device/UsbScanEx.cpp +++ b/huagao/Device/UsbScanEx.cpp @@ -164,14 +164,9 @@ int UsbScanEx::read_bulk(void* data, int len) int error_code = GetLastError(); switch (error_code) { - case ERROR_IO_PENDING: { - int re = GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE); - if (0 != re) - { - return pdw_ret; - } - error_code = GetLastError(); - } + case ERROR_IO_PENDING: + GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE); + return pdw_ret; case ERROR_FILE_NOT_FOUND: case ERROR_ACCESS_DENIED: m_b_is_connected = false; @@ -206,10 +201,9 @@ int UsbScanEx::write_bulk(void* data, int len) int errorcode = GetLastError(); switch (errorcode) { - case ERROR_IO_PENDING: { - if (0 != GetOverlappedResult(h_pipe, lp_overlap, &dw_size, TRUE)) - return dw_size; - } + case ERROR_IO_PENDING: + GetOverlappedResult(h_pipe, lp_overlap, &dw_size, TRUE); + return dw_size; case ERROR_FILE_NOT_FOUND: case ERROR_ACCESS_DENIED: m_b_is_connected = false; diff --git a/huagao/Device/filetools.h b/huagao/Device/filetools.h index 913b4844..fa451e90 100644 --- a/huagao/Device/filetools.h +++ b/huagao/Device/filetools.h @@ -40,6 +40,23 @@ public: p=localtime(&timp); ofs << p->tm_year+1900 << "/" << p->tm_mon+1 << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<setName(LOG4CPLUS_TEXT("file")); + // log4cplus::tstring pattern = LOG4CPLUS_TEXT("%D{%m/%d/%y %H:%M:%S,%Q} [%t] %-5p %c - %m [%l]%n"); + // rf->setLayout(std::unique_ptr(new log4cplus::PatternLayout(pattern))); + + // log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("hglog")); + // logger.setLogLevel(log4cplus::INFO_LOG_LEVEL); + // logger.addAppender(rf); + // LOG4CPLUS_WARN(logger, log.c_str()); + // logger.removeAllAppenders(); + //} private: static void getFiles(std::string path, std::vector& files) diff --git a/huagao/ImageProcess/ImageApplyRotation.cpp b/huagao/ImageProcess/ImageApplyRotation.cpp index 78f2e517..94cce93f 100644 --- a/huagao/ImageProcess/ImageApplyRotation.cpp +++ b/huagao/ImageProcess/ImageApplyRotation.cpp @@ -104,16 +104,8 @@ void CImageApplyRotation::apply(cv::Mat & pDib, int side) { if (m_rotation == RotationType::Rotate_90_clockwise || m_rotation == RotationType::Rotate_90_anti_clockwise) //90锟斤拷 -90锟斤拷 { - if (side == 0) - { - transpose(pDib, pDib); - flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 1 : 0); - } - else - { - transpose(pDib, pDib); - flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 0 : 1); - } + transpose(pDib, pDib); + flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 0 : 1); } else if (m_rotation == RotationType::Rotate_180) { diff --git a/huagao/stdafx.h b/huagao/stdafx.h index 9130e6f0f80f823cecc76bd6b06c6398592882c0..2beeff0990cbb381e5c70d5be6a452850c43eb41 100644 GIT binary patch delta 18 ZcmaD5d?$EA4F{v~WI;8_&9gY%6ah#^25JBR delta 22 dcmcZ;{2+Kk4F{_Ug8_rV