1)修改背面180°不生效问题。

2) 修改usb底层库错误修改导致的安卓机usb连接问题。
This commit is contained in:
masayume 2021-04-10 10:36:03 +08:00
parent 8efc7aed0b
commit e848aabd4a
7 changed files with 30 additions and 27 deletions

View File

@ -582,7 +582,7 @@ void GScanO200::usbmain()
} }
} }
else { else {
if (m_pImages->orginimgcount() > 15) if (m_pImages->orginimgcount() > 10)
{ {
this_thread::sleep_for(chrono::milliseconds(10)); this_thread::sleep_for(chrono::milliseconds(10));
continue; continue;

View File

@ -576,7 +576,7 @@ void GScanO400::usbmain()
} }
} }
else { else {
if (m_pImages->orginimgcount() > 15) { if (m_pImages->orginimgcount() > 10) {
this_thread::sleep_for(chrono::milliseconds(10)); this_thread::sleep_for(chrono::milliseconds(10));
continue; continue;
} }

View File

@ -162,6 +162,9 @@ void ImageMatQueue::setparam(const GScanCap& param)
fixedSize = papersize.GetPaperSize(param.papertype, 200.0f, param.paperAlign); fixedSize = papersize.GetPaperSize(param.papertype, 200.0f, param.paperAlign);
#endif #endif
m_iaList.push_back(shared_ptr<CImageApply>(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<CImageApply>(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<CImageApply>(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<CImageApply>(new CImageApplyResize(CImageApplyResize::ResizeType::DSIZE, cv::Size(fixedSize.cx, fixedSize.cy), 1.0, 1.0)));
} }
if (param.is_autodiscradblank_normal || param.is_autodiscradblank_vince) { if (param.is_autodiscradblank_normal || param.is_autodiscradblank_vince) {
//m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank())); //m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank()));
@ -376,15 +379,12 @@ void ImageMatQueue::imageproceing(std::vector<std::shared_ptr<std::vector<char>>
mats.push_back(mat); mats.push_back(mat);
mat.release(); mat.release();
#else // G200 #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 front = mat(Rect(0, 0, mat.cols / 2, mat.rows));
Mat back = mat(Rect(mat.cols / 2, 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) { if (scanParam.imageRotateDegree != 0.0 && scanParam.imageRotateDegree != 180.0) {
cv::flip(front, front, 0); cv::flip(front, front, 0);
cv::flip(front, front, 1); cv::flip(front, front, 1);
} }
//FileTools::write_log("scanParam.imageRotateDegree-" + to_string(scanParam.imageRotateDegree));
mats.push_back(back); mats.push_back(back);
mats.push_back(front); mats.push_back(front);
#endif #endif

View File

@ -164,14 +164,9 @@ int UsbScanEx::read_bulk(void* data, int len)
int error_code = GetLastError(); int error_code = GetLastError();
switch (error_code) switch (error_code)
{ {
case ERROR_IO_PENDING: { case ERROR_IO_PENDING:
int re = GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE); GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE);
if (0 != re) return pdw_ret;
{
return pdw_ret;
}
error_code = GetLastError();
}
case ERROR_FILE_NOT_FOUND: case ERROR_FILE_NOT_FOUND:
case ERROR_ACCESS_DENIED: case ERROR_ACCESS_DENIED:
m_b_is_connected = false; m_b_is_connected = false;
@ -206,10 +201,9 @@ int UsbScanEx::write_bulk(void* data, int len)
int errorcode = GetLastError(); int errorcode = GetLastError();
switch (errorcode) switch (errorcode)
{ {
case ERROR_IO_PENDING: { case ERROR_IO_PENDING:
if (0 != GetOverlappedResult(h_pipe, lp_overlap, &dw_size, TRUE)) GetOverlappedResult(h_pipe, lp_overlap, &dw_size, TRUE);
return dw_size; return dw_size;
}
case ERROR_FILE_NOT_FOUND: case ERROR_FILE_NOT_FOUND:
case ERROR_ACCESS_DENIED: case ERROR_ACCESS_DENIED:
m_b_is_connected = false; m_b_is_connected = false;

View File

@ -40,6 +40,23 @@ public:
p=localtime(&timp); p=localtime(&timp);
ofs << p->tm_year+1900 << "/" << p->tm_mon+1 << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<<log << std::endl; ofs << p->tm_year+1900 << "/" << p->tm_mon+1 << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<<log << std::endl;
} }
//static void writelog(std::string log)
//{
// log4cplus::SharedAppenderPtr rf(new log4cplus::RollingFileAppender(
// LOG4CPLUS_TEXT("log.txt"),
// 200 * 1024,
// 5
// ));
// rf->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<log4cplus::Layout>(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: private:
static void getFiles(std::string path, std::vector<std::string>& files) static void getFiles(std::string path, std::vector<std::string>& files)

View File

@ -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<39><30> -90<39><30> if (m_rotation == RotationType::Rotate_90_clockwise || m_rotation == RotationType::Rotate_90_anti_clockwise) //90<39><30> -90<39><30>
{ {
if (side == 0) 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 ? 1 : 0);
}
else
{
transpose(pDib, pDib);
flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 0 : 1);
}
} }
else if (m_rotation == RotationType::Rotate_180) else if (m_rotation == RotationType::Rotate_180)
{ {

Binary file not shown.