2021.3.1 修改协议类型检查

2021.3.3	修复恢复默认值后未勾选移除穿孔但移除穿孔滑动条可滑动bug
2021.3.8	修改多流输出除红算法赋值方式
2021.3.12  延长usbmain等待时间为13秒,解决搓纸失败后图片不上传问题
2021.3.13  修改扫描尺寸默认值为匹配原始尺寸,原为A3
2021.3.15  调整算法顺序,缩放放在二值化之前,G400型号增加最大尺寸以及最大尺寸自动裁剪,针对摩数阅卷软件修改autoscan协议get消息
2021.3.19	修复滑块上下左右按键不更新文本框问题
2021.3.24  添加G200读取32字节编码协议
2021.3.30  添加G300读取32字节编码协议,將多开判断提在打开usb之前
2021.4.1	增加固定幅面16开,8开
2021.4.6	添加200dpi 15张限制
This commit is contained in:
masayume 2021-04-06 09:31:21 +08:00
parent f1738d9a47
commit 8efc7aed0b
24 changed files with 357 additions and 345 deletions

View File

@ -22,8 +22,11 @@ static std::vector<CString> color_Modes = {
#ifdef G200
static std::vector<CString> surportStyles = {
_T("A3"),//pass
_T("8开"),
_T("A4"),
_T("A4横向"),
_T("16开"),
_T("16开横向"),
_T("A5"),
_T("A5横向"),
_T("A6"),
@ -46,6 +49,7 @@ static std::vector<CString> surportStyles = {
#ifdef G300
static std::vector<CString> surportStyles = {
_T("A4"),
_T("16开"),
_T("A5"),
_T("A6"),
//_T("B4"),
@ -60,8 +64,11 @@ static std::vector<CString> surportStyles = {
#ifdef G400
static std::vector<CString> surportStyles = {
_T("A3"),//pass
_T("8开"),
_T("A4"),
_T("A4横向"),
_T("16开"),
_T("16开横向"),
_T("A5"),
_T("A5横向"),
_T("A6"),
@ -76,6 +83,8 @@ static std::vector<CString> surportStyles = {
_T("Double Letter"),//pass
_T("LEGAL"),
_T("匹配原始尺寸"),
_T("最大扫描尺寸自动裁切"),
_T("最大扫描尺寸"),
};
#endif // G400
@ -283,3 +292,5 @@ void CBasicPage::updateCmbDuplex(BOOL insert)
}

View File

@ -49,7 +49,7 @@ BOOL CBrightnessPage::OnInitDialog()
// setup third slider-edit box - floating point
m_Edit_Gamma.SetSlideLink(this, IDC_SLIDER_GAMMA);
m_Edit_Gamma.SetParams(0.01, 5.0, 10, _T("%0.2f"));
m_Edit_Gamma.SetParams(0.01, 5.0, 10, _T("%0.2f"),2);
m_Edit_Gamma.SetValue(1.0);
m_Edit_Thre.SetSlideLink(this, IDC_SLIDER_THRE);

View File

@ -126,7 +126,7 @@ BOOL CImageProcPage::OnInitDialog()
{
CTabPageSSL::OnInitDialog();
m_edit_hole.SetSlideLink(this, IDC_SLDOUTHOLE);
m_edit_hole.SetParams(0.01, 0.50, 10, _T("%0.2f"));
m_edit_hole.SetParams(0.01, 0.50, 10, _T("%0.2f"),20);
m_edit_hole.SetValue(0.10);
m_edit_detachnoise.SetSlideLink(this, IDC_SLIDERDETACHNOISE);

View File

@ -85,7 +85,7 @@ BOOL CTwainUI::OnInitDialog()
UpdateUI();
UpdateListConfig();
//dataChangeFunction();
dataChangeFunction();
return true;
}
@ -188,6 +188,7 @@ void CTwainUI::UpdateUI()
m_pageImageProc->m_ckbRemoveHole = settings->fillhole.is_fillhole==TRUE?TRUE:FALSE;//除穿孔可用性
m_pageImageProc->m_edit_hole.SetValue(settings->fillhole.fillholeratio/ 100.0);//穿孔搜索范围比例系数
m_pageImageProc->m_edit_hole.EnableWindow(settings->fillhole.is_fillhole == TRUE ? TRUE : FALSE);
m_pageImageProc->GetDlgItem(IDC_SLDOUTHOLE)->EnableWindow(m_pageImageProc->m_ckbRemoveHole);
m_pageImageProc->m_ckbDetachNoise = settings->detachnoise.is_detachnoise == TRUE ? TRUE : FALSE;//黑白降噪是否启用
((CButton*)m_pageImageProc->GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(m_pageImageProc->m_ckbDetachNoise);
((CButton*)m_pageImageProc->GetDlgItem(IDC_CHECKDETACHNOISE))->EnableWindow(settings->pixtype != 2);

View File

@ -25,62 +25,68 @@ class CBrightnessPage;
#ifdef G200
static std::map<int, PaperStatus> paperStatusMap = {
{0,{TwSS::A3,PaperAlign::Rot0}},
{1,{TwSS::A4,PaperAlign::Rot0}},
{2,{TwSS::A4,PaperAlign::Rot270}},
{3,{TwSS::A5,PaperAlign::Rot0}},
{4,{TwSS::A5,PaperAlign::Rot270}},
{5,{TwSS::A6,PaperAlign::Rot0}},
{6,{TwSS::A6,PaperAlign::Rot270}},
{7,{TwSS::B4,PaperAlign::Rot0}},
{8,{TwSS::B5,PaperAlign::Rot0}},
{9,{TwSS::B5,PaperAlign::Rot270}},
{10,{TwSS::B6,PaperAlign::Rot0}},
{11,{TwSS::B6,PaperAlign::Rot270}},
{12,{TwSS::USLetter,PaperAlign::Rot0}},
{13,{TwSS::USLetter,PaperAlign::Rot270}},
{14,{TwSS::USLedger,PaperAlign::Rot0}},
{15,{TwSS::USLegal,PaperAlign::Rot0}},
{16,{TwSS::None,PaperAlign::Rot0}},
{17,{TwSS::USStatement,PaperAlign::Rot0}},
{18,{TwSS::MaxSize,PaperAlign::Rot0}}
{1,{TwSS::K8,PaperAlign::Rot0}},
{2,{TwSS::A4,PaperAlign::Rot0}},
{3,{TwSS::A4,PaperAlign::Rot270}},
{4,{TwSS::K16,PaperAlign::Rot0}},
{5,{TwSS::K16,PaperAlign::Rot270}},
{6,{TwSS::A5,PaperAlign::Rot0}},
{7,{TwSS::A5,PaperAlign::Rot270}},
{8,{TwSS::A6,PaperAlign::Rot0}},
{9,{TwSS::A6,PaperAlign::Rot270}},
{10,{TwSS::B4,PaperAlign::Rot0}},
{11,{TwSS::B5,PaperAlign::Rot0}},
{12,{TwSS::B5,PaperAlign::Rot270}},
{13,{TwSS::B6,PaperAlign::Rot0}},
{14,{TwSS::B6,PaperAlign::Rot270}},
{15,{TwSS::USLetter,PaperAlign::Rot0}},
{16,{TwSS::USLetter,PaperAlign::Rot270}},
{17,{TwSS::USLedger,PaperAlign::Rot0}},
{18,{TwSS::USLegal,PaperAlign::Rot0}},
{19,{TwSS::None,PaperAlign::Rot0}},
{20,{TwSS::USStatement,PaperAlign::Rot0}},
{21,{TwSS::MaxSize,PaperAlign::Rot0}}
};
#endif
#ifdef G300
static std::map<int, PaperStatus> paperStatusMap = {
{0,{TwSS::A4,PaperAlign::Rot0}},
{1,{TwSS::A5,PaperAlign::Rot0}},
{2,{TwSS::A6,PaperAlign::Rot0}},
//{3,{TwSS::B4,PaperAlign::Rot0}},
{3,{TwSS::B5,PaperAlign::Rot0}},
{4,{TwSS::B6,PaperAlign::Rot0}},
{5,{TwSS::USLetter,PaperAlign::Rot0}},
{6,{TwSS::USLegal,PaperAlign::Rot0}},
{7,{TwSS::None,PaperAlign::Rot0}},
{1,{TwSS::K16,PaperAlign::Rot0}},
{2,{TwSS::A5,PaperAlign::Rot0}},
{3,{TwSS::A6,PaperAlign::Rot0}},
{4,{TwSS::B5,PaperAlign::Rot0}},
{5,{TwSS::B6,PaperAlign::Rot0}},
{6,{TwSS::USLetter,PaperAlign::Rot0}},
{7,{TwSS::USLegal,PaperAlign::Rot0}},
{8,{TwSS::None,PaperAlign::Rot0}},
};
#endif
#ifdef G400
static std::map<int, PaperStatus> paperStatusMap = {
{0,{TwSS::A3,PaperAlign::Rot0}},
{1,{TwSS::A4,PaperAlign::Rot0}},
{2,{TwSS::A4,PaperAlign::Rot270}},
{3,{TwSS::A5,PaperAlign::Rot0}},
{4,{TwSS::A5,PaperAlign::Rot270}},
{5,{TwSS::A6,PaperAlign::Rot0}},
{6,{TwSS::A6,PaperAlign::Rot270}},
{7,{TwSS::B4,PaperAlign::Rot0}},
{8,{TwSS::B5,PaperAlign::Rot0}},
{9,{TwSS::B5,PaperAlign::Rot270}},
{10,{TwSS::B6,PaperAlign::Rot0}},
{11,{TwSS::B6,PaperAlign::Rot270}},
{12,{TwSS::USLetter,PaperAlign::Rot0}},
{13,{TwSS::USLetter,PaperAlign::Rot270}},
{14,{TwSS::USLedger,PaperAlign::Rot0}},
{15,{TwSS::USLegal,PaperAlign::Rot0}},
{16,{TwSS::None,PaperAlign::Rot0}},
{17,{TwSS::USStatement,PaperAlign::Rot0}},
{18,{TwSS::MaxSize,PaperAlign::Rot0}}
{1,{TwSS::K8,PaperAlign::Rot0}},
{2,{TwSS::A4,PaperAlign::Rot0}},
{3,{TwSS::A4,PaperAlign::Rot270}},
{4,{TwSS::K16,PaperAlign::Rot0}},
{5,{TwSS::K16,PaperAlign::Rot270}},
{6,{TwSS::A5,PaperAlign::Rot0}},
{7,{TwSS::A5,PaperAlign::Rot270}},
{8,{TwSS::A6,PaperAlign::Rot0}},
{9,{TwSS::A6,PaperAlign::Rot270}},
{10,{TwSS::B4,PaperAlign::Rot0}},
{11,{TwSS::B5,PaperAlign::Rot0}},
{12,{TwSS::B5,PaperAlign::Rot270}},
{13,{TwSS::B6,PaperAlign::Rot0}},
{14,{TwSS::B6,PaperAlign::Rot270}},
{15,{TwSS::USLetter,PaperAlign::Rot0}},
{16,{TwSS::USLetter,PaperAlign::Rot270}},
{17,{TwSS::USLedger,PaperAlign::Rot0}},
{18,{TwSS::USLegal,PaperAlign::Rot0}},
{19,{TwSS::None,PaperAlign::Rot0}},
{20,{TwSS::USStatement,PaperAlign::Rot0}},
{21,{TwSS::MaxSize,PaperAlign::Rot0}}
};
#endif

View File

@ -122,6 +122,8 @@ public:
virtual void Set_ErrorCode(UINT32 value) = 0;
virtual int get_scanned_num() = 0;
virtual void set_sleep_time(int mode) = 0;
virtual bool set_scannercode(std::string str) = 0;
virtual std::string get_scannercode() = 0;
void DoEvents() {
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
@ -137,6 +139,7 @@ protected:
std::mutex m_imgLocker;
std::string fwVersion;
std::string SerialNum;
std::string scannercode;
int pixType;
bool bFilterMsg;
};

View File

@ -130,7 +130,15 @@ typedef enum tagUsbKeyWords : UINT32
//设置纵向畸变系数
SET_JUST_COF_V = 0x41,
//读取纵向畸变系数
GET_JUST_COF_V
GET_JUST_COF_V=0x42,
//设置扫描仪编码
GET_CODE_G400 = 0x59,
//读取扫描仪编码
SET_CODE_G400 = 0x60,
//设置扫描仪编码
SET_CODE_G200=0x63,
//读取扫描仪编码
GET_CODE_G200=0x64,
} UsbKeyWords, * PUsbKeyWords;
@ -323,19 +331,19 @@ void GScanO200::config_params(GScanCap& params)
gcap = params;
UINT32 cfgdata = cfg.GetData();
USBCB usbcb = { CONFIGURED_DATA,cfgdata,0 };
FileTools::write_log("USB config_params:"+to_string(cfgdata)+"\npaper:"+to_string(cfgdata&0x1f)
+ "\ncolor:" + to_string((cfgdata>>5) & 0x1)
+ "\ndpi:" + to_string((cfgdata>>6) & 0x3)
+ "\ndouble_feed_enbale:" + to_string((cfgdata>>8) & 0x1)
+ "\nstable_enbale:" + to_string((cfgdata>>9) & 0x1)
+ "\nscrew_detect_enable:" + to_string((cfgdata>>10) & 0x1)
+ "\nscrew_detect_level:" + to_string((cfgdata>>11) & 0x7)
+ "\nunused_one:" + to_string((cfgdata>>14) & 0x3F)
+ "\npc_correct:" + to_string((cfgdata>>20) & 0x1)
+"\nenable_sizecheck:"+to_string((cfgdata>>21)&0x1)
+ "\nenabledsp_cache:" + to_string((cfgdata >> 22) & 0x1)
+ "\nlowpowermode:" + to_string((cfgdata >> 23) & 0x7)
+ "\nunused_two:" + to_string((cfgdata>>26) & 0x3f));
FileTools::write_log("开始下发硬件参数 ===>\n\tUSB config_params:" + to_string(cfgdata) + "\n\tpaper:" + to_string(cfgdata & 0x1f)
+ "\n\tcolor:" + to_string((cfgdata >> 5) & 0x1)
+ "\n\tdpi:" + to_string((cfgdata >> 6) & 0x3)
+ "\n\tdouble_feed_enbale:" + to_string((cfgdata >> 8) & 0x1)
+ "\n\tstable_enbale:" + to_string((cfgdata >> 9) & 0x1)
+ "\n\tscrew_detect_enable:" + to_string((cfgdata >> 10) & 0x1)
+ "\n\tscrew_detect_level:" + to_string((cfgdata >> 11) & 0x7)
+ "\n\tunused_one:" + to_string((cfgdata >> 14) & 0x3F)
+ "\n\tpc_correct:" + to_string((cfgdata >> 20) & 0x1)
+ "\n\tenable_sizecheck:" + to_string((cfgdata >> 21) & 0x1)
+ "\n\tenabledsp_cache:" + to_string((cfgdata >> 22) & 0x1)
+ "\n\tlowpowermode:" + to_string((cfgdata >> 23) & 0x7)
+ "\n\tunused_two:" + to_string((cfgdata >> 26) & 0x3f));
m_usb->write_bulk(&usbcb, sizeof(USBCB));
this_thread::sleep_for(std::chrono::milliseconds(200));
m_pImages->setparam(params);
@ -480,6 +488,32 @@ void GScanO200::set_sleep_time(int mode)
m_usb->read_bulk(&usbcb, sizeof(usbcb));
}
bool GScanO200::set_scannercode(std::string str)
{
if (str.size() != 32)
return false;
if (!(m_usb.get() && m_usb->is_connected()))
return false;
for (int i = 0; i < str.size(); i += 4)
{
USBCB usbcb = { SET_CODE_G200,UINT32(str[i]) + ((UINT32(str[i + 1])) << 8) + (((UINT32)str[i + 2]) << 16) + (((UINT32)str[i + 3]) << 24),i };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
return true;
}
std::string GScanO200::get_scannercode()
{
if (!(m_usb.get() && m_usb->is_connected()))
return NULL;
USBCB usb{ GET_CODE_G200,0,32 };
m_usb->write_bulk(&usb, sizeof(USBCB));
std::this_thread::sleep_for(std::chrono::milliseconds(20));
scannercode.resize(32);
m_usb->read_bulk(&scannercode[0], 32);
return scannercode.c_str();
}
void GScanO200::usbhotplug_callback(bool isconnect, void* userdata)
{
@ -533,7 +567,7 @@ void GScanO200::usbmain()
}
if (sw.elapsed_ms() > 10000)
if (sw.elapsed_ms() > 13000)
{
m_pImages->setscanflags(false);
devState = haveError ? DevState::DEV_WRONG : DevState::DEV_STOP;
@ -547,6 +581,13 @@ void GScanO200::usbmain()
continue;
}
}
else {
if (m_pImages->orginimgcount() > 15)
{
this_thread::sleep_for(chrono::milliseconds(10));
continue;
}
}
USBCB usbcb = Get_Scanner_Status();
switch (usbcb.u32_Data) {

View File

@ -29,6 +29,8 @@ public:
virtual int get_scanned_num() override;
virtual void clear_hwerror() override;
virtual void set_sleep_time(int mode) override;
virtual bool set_scannercode(std::string str) override;
virtual std::string get_scannercode() override;
virtual void DogEar_callback(std::function<void(int)> fun) override;
private:

View File

@ -133,7 +133,15 @@ typedef enum tagUsbKeyWords : UINT32
//设置纵向畸变系数
SET_JUST_COF_V = 0x41,
//读取纵向畸变系数
GET_JUST_COF_V
GET_JUST_COF_V=0x42,
//设置扫描仪编码
GET_CODE_G400 = 0x59,
//读取扫描仪编码
SET_CODE_G400 = 0x60,
//设置扫描仪编码
SET_CODE_G200 = 0x63,
//读取扫描仪编码
GET_CODE_G200 = 0x64,
} UsbKeyWords, * PUsbKeyWords;
@ -326,16 +334,16 @@ void GScanO400::config_params(GScanCap& params)
gcap = params;
UINT32 cfgdata = cfg.GetData();
USBCB usbcb = { CONFIGURED_DATA,cfgdata,0 };
FileTools::write_log("USB config_params:"+to_string(cfgdata)+"\npaper:"+to_string(cfgdata&0x1f)
+ "\ncolor:" + to_string((cfgdata>>5) & 0x1)
+ "\ndpi:" + to_string((cfgdata>>6) & 0x3)
+ "\ndouble_feed_enbale:" + to_string((cfgdata>>8) & 0x1)
+ "\nstable_enbale:" + to_string((cfgdata>>9) & 0x1)
+ "\nenableLed:" + to_string((cfgdata>>10) & 0x1)
+ "\nreversed1:" + to_string((cfgdata>>11) & 0x3F)
+ "\nisCorrect:" + to_string((cfgdata>>17) & 0x1)
+ "\ndstHeight:" + to_string((cfgdata>>18) & 0xFF)
+ "\nreversed2:" + to_string((cfgdata>>26) & 0x3F));
FileTools::write_log("开始下发硬件参数 ===> \n\tUSB config_params:"+to_string(cfgdata)+"\n\tpaper:"+to_string(cfgdata&0x1f)
+ "\n\tcolor:" + to_string((cfgdata>>5) & 0x1)
+ "\n\tdpi:" + to_string((cfgdata>>6) & 0x3)
+ "\n\tdouble_feed_enbale:" + to_string((cfgdata>>8) & 0x1)
+ "\n\tstable_enbale:" + to_string((cfgdata>>9) & 0x1)
+ "\n\tenableLed:" + to_string((cfgdata>>10) & 0x1)
+ "\n\treversed1:" + to_string((cfgdata>>11) & 0x3F)
+ "\n\tisCorrect:" + to_string((cfgdata>>17) & 0x1)
+ "\n\tdstHeight:" + to_string((cfgdata>>18) & 0xFF)
+ "\n\treversed2:" + to_string((cfgdata>>26) & 0x3F));
m_usb->write_bulk(&usbcb, sizeof(USBCB));
this_thread::sleep_for(std::chrono::milliseconds(200));
m_pImages->setparam(params);
@ -476,6 +484,31 @@ void GScanO400::set_sleep_time(int mode)
return ;
}
bool GScanO400::set_scannercode(std::string str)
{
if (str.size() != 32)
return false;
if (!(m_usb.get() && m_usb->is_connected()))
return false;
for (int i = 0; i < str.size(); i += 4)
{
USBCB usbcb = { SET_CODE_G400,UINT32(str[i]) + ((UINT32(str[i + 1])) << 8) + (((UINT32)str[i + 2]) << 16) + (((UINT32)str[i + 3]) << 24),i };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
return true;
}
std::string GScanO400::get_scannercode()
{
if (!(m_usb.get() && m_usb->is_connected()))
return NULL;
USBCB usb{ GET_CODE_G400,0,32 };
m_usb->write_bulk(&usb, sizeof(USBCB));
std::this_thread::sleep_for(std::chrono::milliseconds(20));
scannercode.resize(32);
m_usb->read_bulk(&scannercode[0], 32);
return scannercode.c_str();
}
void GScanO400::usbhotplug_callback(bool isconnect, void* userdata)
{
@ -528,7 +561,7 @@ void GScanO400::usbmain()
}
if (sw.elapsed_ms() > 10000)
if (sw.elapsed_ms() > 13000)
{
m_pImages->setscanflags(false);
devState = haveError ? DevState::DEV_WRONG : DevState::DEV_STOP;
@ -542,6 +575,12 @@ void GScanO400::usbmain()
continue;
}
}
else {
if (m_pImages->orginimgcount() > 15) {
this_thread::sleep_for(chrono::milliseconds(10));
continue;
}
}
USBCB usbcb = Get_Scanner_Status();
switch (usbcb.u32_Data) {

View File

@ -29,6 +29,8 @@ public:
virtual int get_scanned_num() override;
virtual void clear_hwerror() override;
virtual void set_sleep_time(int mode) override;
virtual bool set_scannercode(std::string str);
virtual std::string get_scannercode();
virtual void DogEar_callback(std::function<void(int)> fun) override;
private:

View File

@ -241,14 +241,7 @@ void ImageMatQueue::setparam(const GScanCap& param)
//×Ô¶¯ÑÕɫʶ±ð
if (param.automaticcolor)
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyColorRecognition(param.automaticcolortype==1? CImageApplyColorRecognition::ColorRecognitionMode::Color_Gray:CImageApplyColorRecognition::ColorRecognitionMode::Color_Mono)));
//¶þÖµ»¯
if (param.pixtype == 0) //threshold
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyBWBinaray(CImageApplyBWBinaray::ThresholdType::THRESH_BINARY)));
//ºÚ°×½µÔëÓÅ»¯
if (scanParam.detachnoise.is_detachnoise&&scanParam.pixtype==0)
{
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDetachNoise(scanParam.detachnoise.detachnoise)));
}
//Ëõ·Å
if (param.resolution_dst != param.resolution_native)
{
CImageApplyResize* apply;
@ -265,6 +258,15 @@ void ImageMatQueue::setparam(const GScanCap& param)
}
m_iaList.push_back(shared_ptr< CImageApply>(apply));
}
//¶þÖµ»¯
if (param.pixtype == 0) //threshold
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyBWBinaray(CImageApplyBWBinaray::ThresholdType::THRESH_BINARY)));
//ºÚ°×½µÔëÓÅ»¯
if (scanParam.detachnoise.is_detachnoise&&scanParam.pixtype==0)
{
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDetachNoise(scanParam.detachnoise.detachnoise)));
}
if (scanParam.en_fold)
@ -325,9 +327,9 @@ bool ImageMatQueue::queuesempty()
static int index = 0;
void ImageMatQueue::proc()
{
int dwnumber = std::thread::thread::hardware_concurrency();
std::unique_ptr<ThreadPool> m_threadpool;
m_threadpool.reset(new ThreadPool(dwnumber < 4 ? 1 : dwnumber / 2));
//int dwnumber = std::thread::thread::hardware_concurrency();
//std::unique_ptr<ThreadPool> m_threadpool;
//m_threadpool.reset(new ThreadPool(dwnumber < 4 ? 1 : dwnumber / 2));
while (bRun) {
while (m_imagedata.Size() > 0) {
this_thread::sleep_for(chrono::milliseconds(1));
@ -341,11 +343,11 @@ void ImageMatQueue::proc()
auto& buffs = m_rawBuffs.Take()->getImageBuffs();
if (!m_rawBuffs.IsShutDown() && !buffs.empty()) {
m_threadpool->enqueue(&ImageMatQueue::imageproceing, this, buffs);
//imageproceing(buffs);
//m_threadpool->enqueue(&ImageMatQueue::imageproceing, this, buffs);
imageproceing(buffs);
}
}
m_threadpool.reset();
//m_threadpool.reset();
}
void ImageMatQueue::imageproceing(std::vector<std::shared_ptr<std::vector<char>>>& buffs)
@ -364,12 +366,7 @@ void ImageMatQueue::imageproceing(std::vector<std::shared_ptr<std::vector<char>>
}
try
{
//StopWatch sw;
cv::Mat mat = cv::imdecode(*buf, rmc);
//cv::Mat jmat(1, buf->size(), CV_8UC1,buf->data());
//cv::Mat mat=JpegBuffer(jmat,rm , 0).getMat(rm);
//jmat.release();
//double epl= sw.elapsed_ms();
buf.reset();
if (mat.empty()) {
writelog("decode image data error");
@ -414,6 +411,7 @@ void ImageMatQueue::imageproceing(std::vector<std::shared_ptr<std::vector<char>>
// }
//}
//FileTools::write_log("1.txt", " dogear time " + to_string(sw.elapsed_ms()));
static int index = 0;
if (scanParam.is_switchfrontback)
swap(mats[0], mats[1]);
if (scanParam.en_fold != 0) {
@ -423,7 +421,7 @@ void ImageMatQueue::imageproceing(std::vector<std::shared_ptr<std::vector<char>>
for (int j = 0; j < m_iaList.size(); j++) {
m_iaList[j]->apply(mats, scanParam.is_duplex);
}
static int index = 0;
for (int i = 0; i < mats.size(); i++) {
if (!scanParam.is_duplex && i == 1) {
mats[i].release();

View File

@ -46,11 +46,15 @@ cv::Mat ImageMultiOutput::FilterColor(cv::Mat image,short channel)
{
for ( int x = 0; x < image.cols; x++, src += channels , dst++ )
{
unsigned short pix = *src;
if(pix >=130){
pix = 255;
}
*dst = pix;
//unsigned short pix = *src;
//if(pix >=130){
// pix = 255;
//}
//*dst = pix;
if (*src >= 130)
*dst = 255;
else
*dst = *src;
}
src += srcOffset;
dst += dstOffset;

View File

@ -17,142 +17,6 @@ namespace Device {
void PaperSize::InitPaperMap()
{
////!< ×ÔÊÊÓ¦
//dpiDct[{None, 50.0f}] = CSize(594, 898);
//dpiDct[{None, 75.0f}] = CSize(892, 1347);
//dpiDct[{None, 100.0f}] = CSize(1189, 1795);
//dpiDct[{None, 150.0f}] = CSize(1784, 2693);
//dpiDct[{None, 200.0f}] = CSize(2338, 3307);
//dpiDct[{None, 240.0f}] = CSize(2854, 4308);
//dpiDct[{None, 300.0f}] = CSize(3567, 5385);
//dpiDct[{None, 400.0f}] = CSize(4756, 7180);
//dpiDct[{None, 600.0f}] = CSize(7134, 10770);
////A3
//dpiDct[{A3, 50.0f}] = CSize(585, 827);
//dpiDct[{A3, 75.0f}] = CSize(877, 1240);
//dpiDct[{A3, 100.0f}] = CSize(1169, 1653);
//dpiDct[{A3, 150.0f}] = CSize(1753, 2480);
//dpiDct[{A3, 200.0f}] = CSize(2338, 3307);
//dpiDct[{A3, 240.0f}] = CSize(2806, 3968);
//dpiDct[{A3, 300.0f}] = CSize(3507, 4960);
//dpiDct[{A3, 400.0f}] = CSize(4677, 6614);
//dpiDct[{A3, 600.0f}] = CSize(7015, 9921);
////add lyc 2019 12 18
////A4
//dpiDct[{A4, 50.0f}] = CSize(413, 585);
//dpiDct[{A4, 75.0f}] = CSize(620, 877);
//dpiDct[{A4, 100.0f}] = CSize(826, 1169);
//dpiDct[{A4, 150.0f}] = CSize(1240, 1753);
//dpiDct[{A4, 200.0f}] = CSize(1653, 2338);
//dpiDct[{A4, 240.0f}] = CSize(1984, 2806);
//dpiDct[{A4, 300.0f}] = CSize(2480, 3507);
//dpiDct[{A4, 400.0f}] = CSize(3307, 4677);
//dpiDct[{A4, 600.0f}] = CSize(4960, 7015);
////add lyc 2019 12 18 A5
//dpiDct[{A5, 50.0f}] = CSize(291, 413);
//dpiDct[{A5, 75.0f}] = CSize(437, 620);
//dpiDct[{A5, 100.0f}] = CSize(582, 826);
//dpiDct[{A5, 150.0f}] = CSize(874, 1240);
//dpiDct[{A5, 200.0f}] = CSize(1165, 1653);
//dpiDct[{A5, 240.0f}] = CSize(1398, 1984);
//dpiDct[{A5, 300.0f}] = CSize(1748, 2480);
//dpiDct[{A5, 400.0f}] = CSize(2330, 3307);
//dpiDct[{A5, 600.0f}] = CSize(3496, 4960);
////add lyc 2019 12 18 A6
//dpiDct[{A6, 50.0f}] = CSize(207, 291);
//dpiDct[{A6, 75.0f}] = CSize(310, 437);
//dpiDct[{A6, 100.0f}] = CSize(413, 582);
//dpiDct[{A6, 150.0f}] = CSize(620, 874);
//dpiDct[{A6, 200.0f}] = CSize(826, 1165);
//dpiDct[{A6, 240.0f}] = CSize(992, 1398);
//dpiDct[{A6, 300.0f}] = CSize(1240, 1748);
//dpiDct[{A6, 400.0f}] = CSize(1653, 2330);
//dpiDct[{A6, 600.0f}] = CSize(2480, 3496);
//dpiDct[{USStatement, 50.0f}] = CSize(585, 827 * 1.5);
//dpiDct[{USStatement, 75.0f}] = CSize(877, 1240 * 1.5);
//dpiDct[{USStatement, 100.0f}] = CSize(1169, 1653 * 1.5);
//dpiDct[{USStatement, 150.0f}] = CSize(1753, 2480 * 1.5);
//dpiDct[{USStatement, 200.0f}] = CSize(2338, 3307 * 1.5);
//dpiDct[{USStatement, 240.0f}] = CSize(2806, 3968 * 1.5);
//dpiDct[{USStatement, 300.0f}] == CSize(3507, 4960 * 1.5);
//dpiDct[{USStatement, 400.0f}] = CSize(4677, 6614 * 1.5);
//dpiDct[{USStatement, 600.0f}] = CSize(7015, 9921 * 1.5);
////add lyc 2019 12 18 ³¤Îĸ壬2±¶A3
//dpiDct[{MaxSize, 50.0f}] = CSize(585, 1653);
//dpiDct[{MaxSize, 75.0f}] = CSize(877, 2480);
//dpiDct[{MaxSize, 100.0f}] = CSize(1169, 1653 * 2);
//dpiDct[{MaxSize, 150.0f}] = CSize(1753, 2480 * 2);
//dpiDct[{MaxSize, 200.0f}] = CSize(2338, 3307 * 2);
//dpiDct[{MaxSize, 240.0f}] = CSize(2806, 3968 * 2);
//dpiDct[{MaxSize, 300.0f}] = CSize(3507, 4960 * 2);
//dpiDct[{MaxSize, 400.0f}] = CSize(4677, 6614 * 2);
//dpiDct[{MaxSize, 600.0f}] = CSize(7015, 9921 * 2);
////add lyc 2019 12 18 B4
//dpiDct[{B4, 50.0f}] = CSize(506, 717);
//dpiDct[{B4, 75.0f}] = CSize(759, 1075);
//dpiDct[{B4, 100.0f}] = CSize(1011, 1433);
//dpiDct[{B4, 150.0f}] = CSize(1517, 2149);
//dpiDct[{B4, 200.0f}] = CSize(2023, 2866);
//dpiDct[{B4, 240.0f}] = CSize(2428, 3439);
//dpiDct[{B4, 300.0f}] = CSize(3035, 4299);
//dpiDct[{B4, 400.0f}] = CSize(4047, 5732);
//dpiDct[{B4, 600.0f}] = CSize(6070, 8598);
////add lyc 2019 12 18 B5
//dpiDct[{B5, 50.0f}] = CSize(358, 506);
//dpiDct[{B5, 75.0f}] = CSize(537, 759);
//dpiDct[{B5, 100.0f}] = CSize(716, 1011);
//dpiDct[{B5, 150.0f}] = CSize(1074, 1517);
//dpiDct[{B5, 200.0f}] = CSize(1433, 2023);
//dpiDct[{B5, 240.0f}] = CSize(1719, 2428);
//dpiDct[{B5, 300.0f}] = CSize(2149, 3035);
//dpiDct[{B5, 400.0f}] = CSize(2866, 4047);
//dpiDct[{B5, 600.0f}] = CSize(4299, 6070);
////add lyc 2019 12 18 B6
//dpiDct[{B6, 50.0f}] = CSize(252, 358);
//dpiDct[{B6, 75.0f}] = CSize(378, 537);
//dpiDct[{B6, 100.0f}] = CSize(503, 716);
//dpiDct[{B6, 150.0f}] = CSize(755, 1074);
//dpiDct[{B6, 200.0f}] = CSize(1007, 1433);
//dpiDct[{B6, 240.0f}] = CSize(1209, 1719);
//dpiDct[{B6, 300.0f}] = CSize(1511, 2149);
//dpiDct[{B6, 400.0f}] = CSize(2015, 2866);
//dpiDct[{B6, 600.0f}] = CSize(3023, 4299);
////add lyc 2019 12 18 DOUBLE LETTER
//dpiDct[{USLedger, 50.0f}] = CSize(550, 850);
//dpiDct[{USLedger, 75.0f}] = CSize(825, 1275);
//dpiDct[{USLedger, 100.0f}] = CSize(1100, 1700);
//dpiDct[{USLedger, 150.0f}] = CSize(1650, 2550);
//dpiDct[{USLedger, 200.0f}] = CSize(2200, 3400);
//dpiDct[{USLedger, 240.0f}] = CSize(2640, 4080);
//dpiDct[{USLedger, 300.0f}] = CSize(3300, 5100);
//dpiDct[{USLedger, 400.0f}] = CSize(4400, 6800);
//dpiDct[{USLedger, 600.0f}] = CSize(6600, 10200);
////add lyc 2019 12 18 LETTER
//dpiDct[{USLetter, 50.0f}] = CSize(425, 550);
//dpiDct[{USLetter, 75.0f}] = CSize(638, 825);
//dpiDct[{USLetter, 100.0f}] = CSize(850, 1100);
//dpiDct[{USLetter, 150.0f}] = CSize(1275, 1650);
//dpiDct[{USLetter, 200.0f}] = CSize(1700, 2200);
//dpiDct[{USLetter, 240.0f}] = CSize(2040, 2640);
//dpiDct[{USLetter, 300.0f}] = CSize(2550, 3300);
//dpiDct[{USLetter, 400.0f}] = CSize(3400, 4400);
//dpiDct[{USLetter, 600.0f}] = CSize(5100, 6600);
////add lyc 2019 12 18 LETTER
//dpiDct[{USLegal, 50.0f}] = CSize(425, 700);
//dpiDct[{USLegal, 75.0f}] = CSize(638, 1050);
//dpiDct[{USLegal, 100.0f}] = CSize(850, 1400);
//dpiDct[{USLegal, 150.0f}] = CSize(1275, 2100);
//dpiDct[{USLegal, 200.0f}] = CSize(1700, 2800);
//dpiDct[{USLegal, 240.0f}] = CSize(2040, 3360);
//dpiDct[{USLegal, 300.0f}] = CSize(2550, 4200);
//dpiDct[{USLegal, 400.0f}] = CSize(3400, 5600);
//dpiDct[{USLegal, 600.0f}] = CSize(5100, 8400);
papersize.insert({ A3,CSize(297,420) });
papersize.insert({ A4,CSize(210,297) });
papersize.insert({ A5,CSize(148,210) });
@ -166,6 +30,8 @@ namespace Device {
papersize.insert({ USLegal,CSize(216,356) });
papersize.insert({ USLedger,CSize(297,432) });
papersize.insert({ None,CSize(297,420) });
papersize.insert({ K8,CSize(270,390) });
papersize.insert({ K16,CSize(190,270) });
}
CSize PaperSize::GetPaperSize(DWORD paperType, float dpi,int orentation)

View File

@ -63,6 +63,8 @@ enum TwSS : unsigned short
USStatement = 52,
BusinessCard = 53,
MaxSize = 54,
K8 = 0x81,
K16 = 0x82,
};
namespace Device {

View File

@ -165,9 +165,13 @@ int UsbScanEx::read_bulk(void* data, int len)
switch (error_code)
{
case ERROR_IO_PENDING: {
if (0 != GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE))
int re = GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE);
if (0 != re)
{
return pdw_ret;
}
error_code = GetLastError();
}
case ERROR_FILE_NOT_FOUND:
case ERROR_ACCESS_DENIED:
m_b_is_connected = false;

View File

@ -85,7 +85,9 @@ void CLinkSlider::HScroll( UINT ncode, UINT pos )
switch( ncode )
{
case TB_LINEUP :
case TB_PAGEUP :
case TB_LINEDOWN:
case TB_PAGEDOWN :
m_iPosition = GetPos();
m_pEdit->UpdateEdit( m_iPosition );
@ -110,8 +112,10 @@ void CLinkSlider::VScroll( UINT ncode, UINT pos )
// we have to play some games with vertical sliders -
// max position is on the bottom and min is on the top
case TB_PAGEUP :
case TB_PAGEDOWN :
case TB_LINEUP:
case TB_PAGEUP:
case TB_LINEDOWN:
case TB_PAGEDOWN:
m_iPosition = m_iMax - ( GetPos() - m_iMin );
m_pEdit->UpdateEdit( m_iPosition );
break;
@ -121,3 +125,5 @@ void CLinkSlider::VScroll( UINT ncode, UINT pos )
m_pEdit->UpdateEdit( m_iPosition );
}
}

View File

@ -248,8 +248,7 @@ int CSmartEdit::InitSlider()
m_iRange = m_iMax - m_iMin;
m_pSlider->SetSlideRange(m_iMin, m_iMax);
int freq = m_iRange / m_iBands;
m_pSlider->SetTicFreq(freq);
m_pSlider->SetPageSize(m_iBands);
return TRUE;
}
@ -267,6 +266,7 @@ int CSmartEdit::SetParams( cint imin, cint imax, cint ticbands )
m_iMin = imin;
m_iMax = imax;
InitSlider();
m_pSlider->SetTicFreq(m_iRange / m_iBands);
SetFormatString( _T("%d") );
WORD type = SES_NUMBERS;
if( imin < 0 )
@ -277,7 +277,7 @@ int CSmartEdit::SetParams( cint imin, cint imax, cint ticbands )
int CSmartEdit::SetParams( cdbl dmin, cdbl dmax,
cint ticbands, CString fmtstring )
cint ticbands, CString fmtstring, cint linesize)
{
m_bUseFp = TRUE;
m_iBands = ticbands;
@ -286,8 +286,9 @@ int CSmartEdit::SetParams( cdbl dmin, cdbl dmax,
m_dMax = dmax;
m_iMin = 0;
m_iMax = 1000;
InitSlider();
m_pSlider->SetTicFreq(100);
m_pSlider->SetLineSize(linesize);
SetFormatString( fmtstring );
SetParseType( SES_FLOATINGPT );
return TRUE;

View File

@ -104,7 +104,7 @@ public:
int SetParams( cint imin, cint imax, cint ticbands );
int SetParams( cdbl dmin, cdbl dmax,
cint tbands, CString fmtstring );
cint tbands, CString fmtstring,cint linesize );
int SetValue( cint ivalue );
int SetValue( cdbl dvalue );
@ -135,6 +135,7 @@ protected:
//{{AFX_MSG(CSmartEdit)
afx_msg void OnChar(UINT, UINT, UINT);
afx_msg void OnUpdate(); // used with a linked slider
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

View File

@ -50,16 +50,23 @@ enum class CapTypeEx : unsigned short {
TwEx_SwitchFrontBack = 0x8094,
TwEx_HsvCorrect = 0x8095,
TwEx_DogEarDelection = 0x8096,
TwEx_FillBacngroundMode = 0x8097,
TwEx_FillBackgroundMode = 0x8097,
TwEx_CroporDesaskewIndent = 0x8098,
TwEx_CropNoise=0x8099,
TwEx_CroporDesaskewThreshold=0x8100,
TwEx_IDetachNoise = 0x8101,
TwEx_IDetachNoiseValue = 0x8102,
TwEx_SizeDetect=0x8103,
TwEx_LowPowerMode=0x8104
TwEx_LowPowerMode=0x8104,
TwEx_ENCODE=0x8105,
};
enum class PaperSizeEx : unsigned short {
K8 = 0x81,
K16 = 0x82,
};
using namespace Twpp;
using namespace std::placeholders;
@ -178,7 +185,7 @@ static list<UInt16> paperSizeList = { (UInt16)PaperSize::A4,(UInt16)PaperSize::A
static list<UInt16> paperSizeList = { (UInt16)PaperSize::A3,(UInt16)PaperSize::A4,(UInt16)PaperSize::A5,(UInt16)PaperSize::A6,
(UInt16)PaperSize::IsoB4,(UInt16)PaperSize::IsoB5,(UInt16)PaperSize::IsoB6,
(UInt16)PaperSize::UsLetter,(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::UsLedger,
(UInt16)PaperSize::None };
(UInt16)PaperSize::MaxSize,(UInt16)PaperSize::None,(UInt16)PaperSize::UsStatement };
#endif // G200
static list<float> imageRotateList = { 0.0,90.0,180.0,270.0 };
@ -213,6 +220,21 @@ static map<unsigned int, DeviceEvent::Type> mapDeviceEvent = {
{DOG_EAR,(DeviceEvent::Type)(DeviceEventType::Dev_DogEar)}
};
static std::map<WORD, WORD> DeviceID{
{0x64B,0x7823},
#ifdef G200
#ifdef ISG100
{0x3072,0x100},
#else
{0x3072,0x200},
#endif // ISG100
#elif defined G300
{0x3072,0x300},
#elif defined G400
{0x3072,0x400},
#endif // ISG100
};
static void DeleteWnd(CDialog* pWnd) {
if (pWnd && pWnd->GetSafeHwnd()) {
if(pWnd->m_hWnd)
@ -673,49 +695,33 @@ void HuagaoDs::dogear_callback(int indexpaper)
Result HuagaoDs::identityOpenDs(const Identity&) {
//writelog("identityOpenDs");
hMutex = CreateMutex(NULL, FALSE, _T("LookitApp"));
if (GetLastError() == ERROR_ALREADY_EXISTS) { //如果已经存在同名的Mutex会得到这个错误.
CloseHandle(hMutex);
hMutex = NULL;
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString("202"), NULL, SW_HIDE);
return { ReturnCode::Failure, ConditionCode::CapBadOperation };
}
auto usblist= UsbScan_List::find_all_usb();
if (!usblist.empty())
{
for each (auto &usb in usblist)
for each (auto & usb in usblist)
{
if (usb.vid == 0x064b && usb.pid == 0x7823){
if (DeviceID.find(usb.vid) != DeviceID.end() && DeviceID.find(usb.vid)->second == usb.pid)
{
vid = usb.vid;
pid = usb.pid;
if (!scanner.get()) {
#ifdef G200
scanner.reset(new GScanO200());
#endif // G200
#ifdef G300
scanner.reset(new GScanO400());
#endif // G300
#ifdef G400
#else
scanner.reset(new GScanO400());
#endif // G400
vid = 0x064b; pid = 0x7823;
break;
}
}
#ifdef G200
#ifdef ISG100
if(usb.vid == 0x3072 && usb.pid == 0x100)
#else //
if (usb.vid == 0x3072 && usb.pid == 0x200)
#endif
#endif // G200
#ifdef G300
if (usb.vid == 0x3072 && usb.pid == 0x300)
#endif // G300
#ifdef G400
if (usb.vid == 0x3072 && usb.pid == 0x400)
#endif // G400
{
pid = usb.pid; vid = usb.vid;
if(pid<=0x200&& (!scanner.get()))
scanner.reset(new GScanO200());
else
scanner.reset(new GScanO400());
break;
}
}
}
m_haveError = false;
@ -727,19 +733,27 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
bmInfo.biBitCount = m_scanparam->pixtype == 2 ? 24 : (m_scanparam->pixtype == 1 ? 8 : 1);
m_iBitdepth = m_scanparam->pixtype == 2 ? 24 : (m_scanparam->pixtype == 1 ? 8 : 1);
#ifdef LANXUM
//scanner->open(0x31c9, 0x8200);
scanner->open(0x3072, 0x300);
scanner->open(0x31c9, 0x8200);
//scanner->open(0x3072, 0x300);
#else
if (vid == 0 || pid == 0)
{
MessageBox(NULL, L"未找到扫描仪,请连接扫描仪!", L"警告", MB_OK);
return seqError();
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString("201"), NULL, SW_HIDE);
if (hMutex) {
CloseHandle(hMutex);
hMutex = NULL;
}
return checkDeviceOnline();
}
scanner->open(vid, pid);
#endif
if (!scanner->IsConnected()) {
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString("201"), NULL, SW_HIDE);
if (hMutex) {
CloseHandle(hMutex);
hMutex = NULL;
}
return checkDeviceOnline();
}
else
@ -747,12 +761,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
scanner->regist_deviceevent_callback(DeviceEvent_callback, this);
scanner->DogEar_callback(std::bind(&HuagaoDs::dogear_callback, this, std::placeholders::_1));
}
hMutex = CreateMutex(NULL, FALSE, _T("LookitApp"));
if (GetLastError() == ERROR_ALREADY_EXISTS) { //如果已经存在同名的Mutex会得到这个错误.
CloseHandle(hMutex);
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString("202"), NULL, SW_HIDE);
return seqError();
}
//MessageBox(NULL, L"2", L"", 0);
// init caps
// there are caps a minimal source must support
@ -980,6 +989,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[CapType::ISupportedSizes] = msgSupportGetAllSetReset;
m_caps[CapType::ISupportedSizes] = [this](Msg msg, Capability& data) {
if (Msg::Set == msg) {
if(m_scanparam->is_autocrop)
return success();
auto paper = data.currentItem<UInt16>();
if (std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), paper)) == paperSizeList.size())
return badValue();
@ -1004,19 +1015,20 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
}
return CapSupGetAllReset<byte, PaperSize, CapType::ISupportedSizes>(msg, data, { PaperSize::A4,PaperSize::A5,PaperSize::A6,
PaperSize::IsoB5,PaperSize::IsoB6,PaperSize::UsLetter,
PaperSize::UsLegal,PaperSize::None
PaperSize::UsLegal,PaperSize::None,(PaperSize)PaperSizeEx::K16
#ifndef G300
#if defined G200
,PaperSize::A3,PaperSize::UsLedger,PaperSize::IsoB4,
PaperSize::MaxSize,PaperSize::UsStatement
PaperSize::MaxSize,PaperSize::UsStatement,(PaperSize)PaperSizeEx::K8,(PaperSize)PaperSizeEx::K16
#elif defined G400
,PaperSize::A3,PaperSize::UsLedger,PaperSize::IsoB4
,PaperSize::A3,PaperSize::UsLedger,PaperSize::IsoB4,PaperSize::MaxSize,PaperSize::UsStatement,
(PaperSize)PaperSizeEx::K8,(PaperSize)PaperSizeEx::K16
#endif
#endif //
},m_scanparam->papertype, PaperSize::A3,
},m_scanparam->papertype, PaperSize::None,
std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), m_scanparam->papertype)) == paperSizeList.size() ? 0 : std::distance(paperSizeList.begin(),
std::find(paperSizeList.begin(), paperSizeList.end(), m_scanparam->papertype)),
std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), 11)));
std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), 0)));
};
#ifdef G200
@ -1084,6 +1096,15 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
return CapSupGetAllEx<Str255, (CapType)CapTypeEx::TwEx_HardwareVersion>(msg, data, str, str);
};
#ifndef G400
m_query[(CapType)(CapTypeEx::TwEx_ENCODE)] = msgSupportGetAll;
//m_caps[(CapType)(CapTypeEx::TwEx_HardwareVersion)] = std::bind(oneValGetString, _1, _2, scanner->GetFWVersion());
m_caps[(CapType)(CapTypeEx::TwEx_ENCODE)] = [this](Msg msg, Capability& data)->Result {
Str255 str;
str.setData(scanner->get_scannercode().c_str(),32);
return CapSupGetAllEx<Str255, (CapType)CapTypeEx::TwEx_ENCODE>(msg, data, str, str);
};
#endif
m_query[CapType::FeederLoaded] = msgSupportGetAll;
m_caps[CapType::FeederLoaded] = [this](Msg msg, Capability& data) -> Result {
return CapSupGetAll<Bool, Bool, CapType::FeederLoaded>(msg, data, Bool(scanner->Get_Scanner_PaperOn()), Bool(scanner->Get_Scanner_PaperOn()));
@ -1208,7 +1229,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_autoscan = autoscan;
return success();
}
return CapSupGetAllReset<Bool, Bool, CapType::AutoScan>(msg, data, { FALSE,TRUE }, m_autoscan, Bool(true), m_autoscan ? 1 : 0, 1);
//return CapSupGetAllReset<Bool, Bool, CapType::AutoScan>(msg, data, { FALSE,TRUE }, m_autoscan, Bool(true), m_autoscan ? 1 : 0, 0);
return CapSupGetAllReset<Bool, Bool, CapType::AutoScan>(msg, data, m_autoscan, FALSE);
};
m_query[CapType::IAutoSize] = msgSupportGetAllSetReset;
@ -1388,14 +1410,14 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
return CapSupGetAllResetEx<int, UInt8, (CapType)CapTypeEx::TwEx_CroporDesaskewThreshold>(msg, data, m_scanparam->AutoCrop_threshold, 40);
};
//ºÚ¿òÌî³ä·½Ê½
m_query[(CapType)(CapTypeEx::TwEx_FillBacngroundMode)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_FillBacngroundMode)] = [this](Msg msg, Capability& data)->Result {
m_query[(CapType)(CapTypeEx::TwEx_FillBackgroundMode)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_FillBackgroundMode)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<Bool>();
m_scanparam->is_convex = mech;
return success();
}
return CapSupGetAllResetEx<bool, Bool, (CapType)CapTypeEx::TwEx_FillBacngroundMode>(msg, data, m_scanparam->is_convex, Bool(true));
return CapSupGetAllResetEx<bool, Bool, (CapType)CapTypeEx::TwEx_FillBackgroundMode>(msg, data, m_scanparam->is_convex, Bool(true));
};
//Ìî´©¿×
m_query[(CapType)(CapTypeEx::TwEx_IFillHole)] = msgSupportGetAllSetReset;
@ -1669,7 +1691,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->hardwarecaps.en_skrewdetect = mech;
return success();
}
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_ScrewDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->sharpen, TRUE, m_scanparam->hardwarecaps.en_skrewdetect ? 1 : 0, 0);
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_ScrewDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->sharpen, TRUE, m_scanparam->hardwarecaps.en_skrewdetect ? 1 : 0, 1);
};
m_query[(CapType)(CapTypeEx::TwEx_ScrewLevel)] = msgSupportGetAllSetReset;
@ -2035,7 +2057,7 @@ Result HuagaoDs::imageNativeXferGet(const Identity& id, ImageNativeXfer& data) {
bmpData.reset(new std::vector<unsigned char>);
//std::string info = "Twain transfered num of " + to_string(++xtfer)+" images";
FileTools::write_log("Twain transfered num of " + to_string(++xtfer) + " images");
FileTools::write_log("正在上传图片 ===> Twain transfered num of " + to_string(++xtfer) + " images");
return { ReturnCode::XferDone, ConditionCode::Success };
}
@ -2302,50 +2324,50 @@ Twpp::Result HuagaoDs::startScan()
}
scanner->ResetScanner();
std::string info = "\n m_scanparam->is_autocrop :" + to_string(m_scanparam->is_autocrop);
info += "\n m_scanparam->colorenable :" + to_string(m_scanparam->automaticcolor);
info += "\n m_scanparam->colorenabletype :" + to_string(m_scanparam->automaticcolortype);
info += "\n m_scanparam->papertype :" + to_string(m_scanparam->papertype);
info += "\n m_scanparam->fillbackground :" + to_string(m_scanparam->fillbackground);
info += "\n m_scanparam->autodescrew :" + to_string(m_scanparam->autodescrew);
info += "\n m_scanparam->brightness :" + to_string(m_scanparam->brightness);
info += "\n m_scanparam->Caption :" + m_scanparam->Caption;
info += "\n m_scanparam->contrast :" + to_string(m_scanparam->contrast);
info += "\n m_scanparam->discardblank_percent :" + to_string(m_scanparam->discardblank_percent);
info += "\n m_scanparam->enhance_color :" + to_string(m_scanparam->enhance_color);
info += "\n m_scanparam->en_fold :" + to_string(m_scanparam->en_fold);
info += "\n m_scanparam->hardwarecaps.capturepixtype :" + to_string(m_scanparam->hardwarecaps.capturepixtype);
info += "\n m_scanparam->hardwarecaps.en_doublefeed :" + to_string(m_scanparam->hardwarecaps.en_doublefeed);
info += "\n m_scanparam->hardwarecaps.en_stapledetect :" + to_string(m_scanparam->hardwarecaps.en_stapledetect);
info += "\n m_scanparam->hardwarecaps.en_skrewdetect :" + to_string(m_scanparam->hardwarecaps.en_skrewdetect);
info += "\n m_scanparam->hardwarecaps.skrewdetectlevel :" + to_string(m_scanparam->hardwarecaps.skrewdetectlevel);
info += "\n m_scanparam->imageRotateDegree :" + to_string(m_scanparam->imageRotateDegree);
info += "\n m_scanparam->is_duplex :" + to_string(m_scanparam->is_duplex);
info += "\n m_scanparam->pixtype :" + to_string(m_scanparam->pixtype);
info += "\n m_scanparam->resolution_dst :" + to_string(m_scanparam->resolution_dst);
info += "\n m_scanparam->resolution_native :" + to_string(m_scanparam->resolution_native);
info += "\n m_scanparam->paperAlign :" + to_string((int)m_scanparam->paperAlign);
info += "\n m_scanparam->gamma :" + to_string(m_scanparam->gamma);
info += "\n m_scanparam->threshold :" + to_string(m_scanparam->threshold);
info += "\n m_scanparam->is_autocontrast :" + to_string(m_scanparam->is_autocontrast);
info += "\n m_scanparam->is_autocrop :" + to_string(m_scanparam->is_autocrop);
info += "\n m_scanparam->fillhole.fillholeratio :" + to_string(m_scanparam->fillhole.fillholeratio);
info += "\n m_scanparam->fillhole.is_fillhole :" + to_string(m_scanparam->fillhole.is_fillhole);
info += "\n m_scanparam->is_autodiscradblank_normal :" + to_string(m_scanparam->is_autodiscradblank_normal);
info += "\n m_scanparam->is_autodiscradblank_vince :" + to_string(m_scanparam->is_autodiscradblank_vince);
info += "\n m_scanparam->is_switchfrontback :" + to_string(m_scanparam->is_switchfrontback);
info += "\n m_scanparam->multi_output_red :" + to_string(m_scanparam->multi_output_red);
info += "\n m_scanparam->hsvcorrect :" + to_string(m_scanparam->hsvcorrect);
info += "\n m_scanparam->filter :" + to_string(m_scanparam->filter);
info += "\n m_scanparam->sharpen :" + to_string(m_scanparam->sharpen);
info += "\n m_scanparam->scannum :" + to_string(m_scanparam->scannum);
info += "\n m_scanparam->is_backrotate180 :" + to_string(m_scanparam->is_backrotate180);
info += "\n m_scanparam->is_autotext :" + to_string(m_scanparam->is_autotext);
info += "\n m_scanparam->SavePath :" + m_scanparam->SavePath;
info += "\n m_scanparam->noise :" + to_string(m_scanparam->noise);
info += "\n m_scanparam->indent :" + to_string(m_scanparam->indent);
info += "\n m_scanparam->AutoCrop_threshold :" + to_string(m_scanparam->AutoCrop_threshold);
info += "\n m_scanparam->is_convex :" + to_string(m_scanparam->is_convex);
std::string info = "开始扫描 ===> 扫描配置参数为:\n\t m_scanparam->is_autocrop :" + to_string(m_scanparam->is_autocrop);
info += "\n\t m_scanparam->colorenable :" + to_string(m_scanparam->automaticcolor);
info += "\n\t m_scanparam->colorenabletype :" + to_string(m_scanparam->automaticcolortype);
info += "\n\t m_scanparam->papertype :" + to_string(m_scanparam->papertype);
info += "\n\t m_scanparam->fillbackground :" + to_string(m_scanparam->fillbackground);
info += "\n\t m_scanparam->autodescrew :" + to_string(m_scanparam->autodescrew);
info += "\n\t m_scanparam->brightness :" + to_string(m_scanparam->brightness);
info += "\n\t m_scanparam->Caption :" + m_scanparam->Caption;
info += "\n\t m_scanparam->contrast :" + to_string(m_scanparam->contrast);
info += "\n\t m_scanparam->discardblank_percent :" + to_string(m_scanparam->discardblank_percent);
info += "\n\t m_scanparam->enhance_color :" + to_string(m_scanparam->enhance_color);
info += "\n\t m_scanparam->en_fold :" + to_string(m_scanparam->en_fold);
info += "\n\t m_scanparam->hardwarecaps.capturepixtype :" + to_string(m_scanparam->hardwarecaps.capturepixtype);
info += "\n\t m_scanparam->hardwarecaps.en_doublefeed :" + to_string(m_scanparam->hardwarecaps.en_doublefeed);
info += "\n\t m_scanparam->hardwarecaps.en_stapledetect :" + to_string(m_scanparam->hardwarecaps.en_stapledetect);
info += "\n\t m_scanparam->hardwarecaps.en_skrewdetect :" + to_string(m_scanparam->hardwarecaps.en_skrewdetect);
info += "\n\t m_scanparam->hardwarecaps.skrewdetectlevel :" + to_string(m_scanparam->hardwarecaps.skrewdetectlevel);
info += "\n\t m_scanparam->imageRotateDegree :" + to_string(m_scanparam->imageRotateDegree);
info += "\n\t m_scanparam->is_duplex :" + to_string(m_scanparam->is_duplex);
info += "\n\t m_scanparam->pixtype :" + to_string(m_scanparam->pixtype);
info += "\n\t m_scanparam->resolution_dst :" + to_string(m_scanparam->resolution_dst);
info += "\n\t m_scanparam->resolution_native :" + to_string(m_scanparam->resolution_native);
info += "\n\t m_scanparam->paperAlign :" + to_string((int)m_scanparam->paperAlign);
info += "\n\t m_scanparam->gamma :" + to_string(m_scanparam->gamma);
info += "\n\t m_scanparam->threshold :" + to_string(m_scanparam->threshold);
info += "\n\t m_scanparam->is_autocontrast :" + to_string(m_scanparam->is_autocontrast);
info += "\n\t m_scanparam->is_autocrop :" + to_string(m_scanparam->is_autocrop);
info += "\n\t m_scanparam->fillhole.fillholeratio :" + to_string(m_scanparam->fillhole.fillholeratio);
info += "\n\t m_scanparam->fillhole.is_fillhole :" + to_string(m_scanparam->fillhole.is_fillhole);
info += "\n\t m_scanparam->is_autodiscradblank_normal :" + to_string(m_scanparam->is_autodiscradblank_normal);
info += "\n\t m_scanparam->is_autodiscradblank_vince :" + to_string(m_scanparam->is_autodiscradblank_vince);
info += "\n\t m_scanparam->is_switchfrontback :" + to_string(m_scanparam->is_switchfrontback);
info += "\n\t m_scanparam->multi_output_red :" + to_string(m_scanparam->multi_output_red);
info += "\n\t m_scanparam->hsvcorrect :" + to_string(m_scanparam->hsvcorrect);
info += "\n\t m_scanparam->filter :" + to_string(m_scanparam->filter);
info += "\n\t m_scanparam->sharpen :" + to_string(m_scanparam->sharpen);
info += "\n\t m_scanparam->scannum :" + to_string(m_scanparam->scannum);
info += "\n\t m_scanparam->is_backrotate180 :" + to_string(m_scanparam->is_backrotate180);
info += "\n\t m_scanparam->is_autotext :" + to_string(m_scanparam->is_autotext);
info += "\n\t m_scanparam->SavePath :" + m_scanparam->SavePath;
info += "\n\t m_scanparam->noise :" + to_string(m_scanparam->noise);
info += "\n\t m_scanparam->indent :" + to_string(m_scanparam->indent);
info += "\n\t m_scanparam->AutoCrop_threshold :" + to_string(m_scanparam->AutoCrop_threshold);
info += "\n\t m_scanparam->is_convex :" + to_string(m_scanparam->is_convex);
FileTools::write_log(info);
#ifndef G200
scanner->clear_hwerror();
@ -2413,7 +2435,6 @@ Twpp::Result HuagaoDs::startScan()
return success();
}
else {
if (guiTwain.get()) {
((CTwainUI*)(guiTwain.get()))->EnableID_OKorID_Cancel(true);
}

View File

@ -7,6 +7,7 @@
#include <functional>
#include <queue>
namespace std {
template<>

Binary file not shown.

Binary file not shown.

View File

@ -1919,7 +1919,10 @@ private:
}
Container<type, DataType> ret(m_cont.get());
if (type != ret.type()){
UINT16 r_type = (UINT16)ret.type();
UINT16 m_type = (UINT16)type;
if (!((((r_type >= 0) || (r_type <= 5)) && ((m_type >= 0) || (m_type <= 5))) || (((r_type >= 9) || (r_type <= 12)) && ((m_type >= 9) || (m_type <= 12))) || (m_type == r_type))) {
//if (type != r_type){
throw ItemTypeException();
}