mirror of http://192.168.1.51:8099/lmh188/twain3.0
1. 新增立思辰twain
2. 增加折角检测 3. 增加600dpi 4. 修改黑框填充默认为填充 5. 修复切换纸张尺寸时,多流输出框显示不正确问题
This commit is contained in:
parent
7c55845f13
commit
220bd66651
|
@ -50,8 +50,18 @@ BOOL CAboutDlg::OnInitDialog()
|
||||||
|
|
||||||
SetDlgItemText(IDC_LBDERIVERVERSON, HG_VERSION_INFO);
|
SetDlgItemText(IDC_LBDERIVERVERSON, HG_VERSION_INFO);
|
||||||
SetDlgItemText(IDC_LBCOMPANY, LIMIT_INFO);
|
SetDlgItemText(IDC_LBCOMPANY, LIMIT_INFO);
|
||||||
|
CStatic* pStatic = (CStatic*)GetDlgItem(IDC_PICABOUTHUAGO);
|
||||||
|
#ifdef MAKEHUAGAO
|
||||||
|
HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BMPABOUTDLG));
|
||||||
|
#else defined LANXUM
|
||||||
|
HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP2));
|
||||||
|
#endif
|
||||||
|
pStatic->ModifyStyle(0xF, SS_BITMAP | SS_CENTERIMAGE);
|
||||||
|
pStatic->SetBitmap(hBitmap);
|
||||||
#ifndef MAKEHUAGAO
|
#ifndef MAKEHUAGAO
|
||||||
|
#ifndef LANXUM
|
||||||
GetDlgItem(IDC_PICABOUTHUAGO)->ShowWindow(FALSE);
|
GetDlgItem(IDC_PICABOUTHUAGO)->ShowWindow(FALSE);
|
||||||
|
#endif // !LANXUM
|
||||||
#endif
|
#endif
|
||||||
SetDlgItemText(IDC_LBDESIGNERVALUE, COMPANY_NAME);
|
SetDlgItemText(IDC_LBDESIGNERVALUE, COMPANY_NAME);
|
||||||
SetDlgItemText(IDC_LBCOMPANYADDRESS, COMPANY_ADDRESS);
|
SetDlgItemText(IDC_LBCOMPANYADDRESS, COMPANY_ADDRESS);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "CAboutDlg.h"
|
#include "CAboutDlg.h"
|
||||||
#include "CTwainUI.h"
|
#include "CTwainUI.h"
|
||||||
#include "CDiscardBlankSetting.h"
|
#include "CDiscardBlankSetting.h"
|
||||||
|
#include "CcardblankDlg.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
static std::vector<CString> color_Modes = {
|
static std::vector<CString> color_Modes = {
|
||||||
|
@ -83,7 +84,8 @@ static std::vector<CString> reslutions{
|
||||||
_T("150"),
|
_T("150"),
|
||||||
_T("200"),
|
_T("200"),
|
||||||
_T("240"),
|
_T("240"),
|
||||||
_T("300")
|
_T("300"),
|
||||||
|
_T("600")
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<CString> duplexs
|
static std::vector<CString> duplexs
|
||||||
|
@ -209,6 +211,10 @@ void CBasicPage::OnCbnSelchangeCmbduplex()
|
||||||
//DevnMax = index == 2 ? 200 : 300;
|
//DevnMax = index == 2 ? 200 : 300;
|
||||||
m_dataChange();
|
m_dataChange();
|
||||||
//}
|
//}
|
||||||
|
if (m_cmBoxDuplex->GetCurSel() == 2 || m_cmBoxDuplex->GetCurSel() == 3)
|
||||||
|
this->GetDlgItem(IDC_BTNDISCARDSETTING)->ShowWindow(SW_SHOW);
|
||||||
|
else
|
||||||
|
this->GetDlgItem(IDC_BTNDISCARDSETTING)->ShowWindow(SW_HIDE);
|
||||||
updateCmbDuplex(TRUE);
|
updateCmbDuplex(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +229,9 @@ void CBasicPage::OnClickedBtndiscardsetting()
|
||||||
//if (nRet == IDOK) {
|
//if (nRet == IDOK) {
|
||||||
// dbs.GetParams(AreaNum, DevnMax);
|
// dbs.GetParams(AreaNum, DevnMax);
|
||||||
//}
|
//}
|
||||||
|
CcardblankDlg settingdlg(discardblank_percent);
|
||||||
|
settingdlg.DoModal();
|
||||||
|
discardblank_percent = settingdlg.discardblank_percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBasicPage::SetScannerInfo(std::string hdVersion, std::string serialNum)
|
void CBasicPage::SetScannerInfo(std::string hdVersion, std::string serialNum)
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
int AreaNum;
|
int AreaNum;
|
||||||
int DevnMax;
|
int DevnMax;
|
||||||
BOOL m_bswitchfrontback;
|
BOOL m_bswitchfrontback;
|
||||||
|
int discardblank_percent;
|
||||||
|
|
||||||
// 对话框数据
|
// 对话框数据
|
||||||
#ifdef AFX_DESIGN_TIME
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
|
|
@ -48,6 +48,7 @@ void CFeedPaperPage::DoDataExchange(CDataExchange* pDX)
|
||||||
DDX_Control(pDX, IDC_CMBORENTATION, m_cmBoxOrentation);
|
DDX_Control(pDX, IDC_CMBORENTATION, m_cmBoxOrentation);
|
||||||
DDX_Control(pDX, IDC_SLDDETECTLEVEL, m_sldSkrewDetecttion);
|
DDX_Control(pDX, IDC_SLDDETECTLEVEL, m_sldSkrewDetecttion);
|
||||||
DDX_Control(pDX, IDC_EDSCANNUM, m_editNum);
|
DDX_Control(pDX, IDC_EDSCANNUM, m_editNum);
|
||||||
|
DDX_Control(pDX, IDC_DogEarDetection, dogear);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CFeedPaperPage::OnInitDialog()
|
BOOL CFeedPaperPage::OnInitDialog()
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
void FeedPaperPageUpdate(int val);
|
void FeedPaperPageUpdate(int val);
|
||||||
void FeedAutoDescrewUpdate(int val);
|
void FeedAutoDescrewUpdate(int val);
|
||||||
void OnInitcmBoxOrentation(int selectIndex);
|
void OnInitcmBoxOrentation(int selectIndex);
|
||||||
|
CButton dogear;
|
||||||
BOOL m_cbDoublePaper;
|
BOOL m_cbDoublePaper;
|
||||||
BOOL m_cbStaple;
|
BOOL m_cbStaple;
|
||||||
BOOL m_cbRotation;
|
BOOL m_cbRotation;
|
||||||
|
|
|
@ -58,7 +58,7 @@ void CImageProcPage::ImageProcPageUpdate(int val)
|
||||||
{
|
{
|
||||||
m_temp->SetCurSel(0);
|
m_temp->SetCurSel(0);
|
||||||
m_temp->EnableWindow(FALSE);
|
m_temp->EnableWindow(FALSE);
|
||||||
t_chMultiOutput->SetCheck(FALSE);
|
//t_chMultiOutput->SetCheck(TRUE);
|
||||||
t_chMultiOutput->EnableWindow(TRUE);
|
t_chMultiOutput->EnableWindow(TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -105,4 +105,4 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/redistribute)
|
||||||
|
|
||||||
set(huagaotwain_path "$<$<CONFIG:Debug>:${LIBRARY_OUTPUT_PATH}\\Debug\\huagaotwain.dll>" "$<$<CONFIG:Release>:${LIBRARY_OUTPUT_PATH}\\Release\\huagaotwain.dll>")
|
set(huagaotwain_path "$<$<CONFIG:Debug>:${LIBRARY_OUTPUT_PATH}\\Debug\\huagaotwain.dll>" "$<$<CONFIG:Release>:${LIBRARY_OUTPUT_PATH}\\Release\\huagaotwain.dll>")
|
||||||
string(REPLACE "/" "\\" huagaotwain_path ${huagaotwain_path})
|
string(REPLACE "/" "\\" huagaotwain_path ${huagaotwain_path})
|
||||||
add_custom_command(TARGET huagaotwain POST_BUILD COMMAND copy ${huagaotwain_path} $ENV{windir}\\twain_32\\huagoscan\\huagaotwain.ds)
|
#add_custom_command(TARGET huagaotwain POST_BUILD COMMAND copy ${huagaotwain_path} $ENV{windir}\\twain_32\\huagoscan\\huagaotwain.ds)
|
|
@ -171,7 +171,7 @@ void CTwainUI::UpdateUI()
|
||||||
m_pageImageProc->m_ckbHSVCorrect = settings->hsvcorrect == TRUE ? TRUE : FALSE;//答题卡除红
|
m_pageImageProc->m_ckbHSVCorrect = settings->hsvcorrect == TRUE ? TRUE : FALSE;//答题卡除红
|
||||||
m_pageImageProc->GetDlgItem(IDC_CKMULTIOUTPUT)->EnableWindow(settings->pixtype == 2);//彩色可用
|
m_pageImageProc->GetDlgItem(IDC_CKMULTIOUTPUT)->EnableWindow(settings->pixtype == 2);//彩色可用
|
||||||
m_pageImageProc->UpdateData(FALSE);
|
m_pageImageProc->UpdateData(FALSE);
|
||||||
|
m_pageFeedPaper->dogear.SetCheck(settings->is_dogeardetection);
|
||||||
//!< Page feed paper
|
//!< Page feed paper
|
||||||
if(settings->is_duplex==TRUE)
|
if(settings->is_duplex==TRUE)
|
||||||
m_pageFeedPaper->m_cbRotation = settings->is_backrotate180==TRUE ? TRUE : FALSE;//背面旋转180
|
m_pageFeedPaper->m_cbRotation = settings->is_backrotate180==TRUE ? TRUE : FALSE;//背面旋转180
|
||||||
|
@ -420,7 +420,7 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs)
|
||||||
settings->is_autodiscradblank_vince = configItem->Duplex == 3;
|
settings->is_autodiscradblank_vince = configItem->Duplex == 3;
|
||||||
//settings->areanum = configItem->DBlank_AreaNum;
|
//settings->areanum = configItem->DBlank_AreaNum;
|
||||||
//settings->devnmax = configItem->DBlank_DevnMax;
|
//settings->devnmax = configItem->DBlank_DevnMax;
|
||||||
|
settings->discardblank_percent = m_pageBasic->discardblank_percent;
|
||||||
//填充黑框
|
//填充黑框
|
||||||
settings->fillbackground = configItem->EnFillBlack;
|
settings->fillbackground = configItem->EnFillBlack;
|
||||||
settings->autodescrew = configItem->EnAutoDescrew;
|
settings->autodescrew = configItem->EnAutoDescrew;
|
||||||
|
@ -433,6 +433,7 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs)
|
||||||
|
|
||||||
settings->is_autotext = configItem->Orentation == 4;
|
settings->is_autotext = configItem->Orentation == 4;
|
||||||
settings->is_backrotate180 =configItem->EnBackRotate180;
|
settings->is_backrotate180 =configItem->EnBackRotate180;
|
||||||
|
settings->is_dogeardetection = m_pageFeedPaper->dogear.GetCheck();
|
||||||
settings->hardwarecaps.en_skrewdetect = configItem->EnScrewDetect;
|
settings->hardwarecaps.en_skrewdetect = configItem->EnScrewDetect;
|
||||||
settings->hardwarecaps.skrewdetectlevel = (int)configItem->ScrewDetectLevel;
|
settings->hardwarecaps.skrewdetectlevel = (int)configItem->ScrewDetectLevel;
|
||||||
settings->hardwarecaps.en_stapledetect = configItem->EnBindingDetect;
|
settings->hardwarecaps.en_stapledetect = configItem->EnBindingDetect;
|
||||||
|
|
|
@ -15,8 +15,8 @@ class CFeedPaperPage;
|
||||||
class CBrightnessPage;
|
class CBrightnessPage;
|
||||||
|
|
||||||
/*配置文件默认索引号*/
|
/*配置文件默认索引号*/
|
||||||
#define SUPPORTRESNUMS 5
|
#define SUPPORTRESNUMS 6
|
||||||
static int Resolutions[SUPPORTRESNUMS] = {100,150,200,240,300};
|
static int Resolutions[SUPPORTRESNUMS] = {100,150,200,240,300,600};
|
||||||
|
|
||||||
#define TWPT_BW 0
|
#define TWPT_BW 0
|
||||||
#define TWPT_GRAY 1
|
#define TWPT_GRAY 1
|
||||||
|
@ -100,7 +100,8 @@ static std::map<int, float> resolutions = {
|
||||||
{1,150.0f},
|
{1,150.0f},
|
||||||
{2,200.0f},
|
{2,200.0f},
|
||||||
{3,240.0f},
|
{3,240.0f},
|
||||||
{4,300.0f}
|
{4,300.0f},
|
||||||
|
{5,600.0f}
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<int, unsigned short> colorModes = {
|
static std::map<int, unsigned short> colorModes = {
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
// CcardblankDlg.cpp: 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "CcardblankDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
|
||||||
|
// CcardblankDlg 对话框
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(CcardblankDlg, CTabPageSSL)
|
||||||
|
|
||||||
|
CcardblankDlg::CcardblankDlg(int pos,CWnd* pParent /*=nullptr*/)
|
||||||
|
: CTabPageSSL(IDD_DISCARDBLANKSETTING, pParent)
|
||||||
|
, discardblank_percent(pos)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CcardblankDlg::~CcardblankDlg()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CcardblankDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CTabPageSSL::DoDataExchange(pDX);
|
||||||
|
DDX_Control(pDX, IDC_SLD_DEVNMAX, m_slider_blank);
|
||||||
|
DDX_Control(pDX, IDC_DBLANK_DEVNMAX, m_edit_blank);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CcardblankDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CTabPageSSL::OnInitDialog();
|
||||||
|
m_edit_blank.SetSlideLink(this, IDC_SLD_DEVNMAX);
|
||||||
|
m_edit_blank.SetParams(1, 100, 10);
|
||||||
|
m_edit_blank.SetValue(discardblank_percent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CcardblankDlg, CTabPageSSL)
|
||||||
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLD_DEVNMAX, &CcardblankDlg::OnNMReleasedcaptureSldDevnmax)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CcardblankDlg 消息处理程序
|
||||||
|
|
||||||
|
|
||||||
|
void CcardblankDlg::OnNMReleasedcaptureSldDevnmax(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
*pResult = 0;
|
||||||
|
discardblank_percent = m_slider_blank.m_iPosition;
|
||||||
|
m_edit_blank.SetValue(discardblank_percent);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
#pragma once
|
||||||
|
#include "TabPageSSL.h"
|
||||||
|
#include "Sliders.h"
|
||||||
|
#include "SmartEdit.h"
|
||||||
|
|
||||||
|
// CcardblankDlg 对话框
|
||||||
|
|
||||||
|
class CcardblankDlg : public CTabPageSSL
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC(CcardblankDlg)
|
||||||
|
|
||||||
|
public:
|
||||||
|
CcardblankDlg(int pos,CWnd* pParent = nullptr); // 标准构造函数
|
||||||
|
virtual ~CcardblankDlg();
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
enum { IDD = IDD_DISCARDBLANKSETTING };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
public:
|
||||||
|
CLinkSlider m_slider_blank;
|
||||||
|
CSmartEdit m_edit_blank;
|
||||||
|
int discardblank_percent = 1;
|
||||||
|
afx_msg void OnNMReleasedcaptureSldDevnmax(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
};
|
|
@ -0,0 +1,31 @@
|
||||||
|
// CdisardblankDlg.cpp: 实现文件
|
||||||
|
//
|
||||||
|
#include "CdisardblankDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
// CdisardblankDlg 对话框
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(CdisardblankDlg, CTabPageSSL)
|
||||||
|
|
||||||
|
CdisardblankDlg::CdisardblankDlg(CWnd* pParent /*=nullptr*/)
|
||||||
|
: CTabPageSSL(IDD_DISCARDBLANKSETTING, pParent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CdisardblankDlg::~CdisardblankDlg()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CdisardblankDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CTabPageSSL::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CdisardblankDlg, CTabPageSSL)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CdisardblankDlg 消息处理程序
|
|
@ -0,0 +1,23 @@
|
||||||
|
#pragma once
|
||||||
|
#include "TabPageSSL.h"
|
||||||
|
#include <afxdlgs.h>
|
||||||
|
// CdisardblankDlg 对话框
|
||||||
|
|
||||||
|
class CdisardblankDlg : public CTabPageSSL
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC(CdisardblankDlg)
|
||||||
|
|
||||||
|
public:
|
||||||
|
CdisardblankDlg(CWnd* pParent = nullptr); // 标准构造函数
|
||||||
|
virtual ~CdisardblankDlg();
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
enum { IDD = IDD_DISCARDBLANKSETTING };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
|
@ -7,6 +7,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <functional>
|
||||||
#include "PublicFunc.h"
|
#include "PublicFunc.h"
|
||||||
|
|
||||||
enum tagDevState
|
enum tagDevState
|
||||||
|
@ -60,6 +61,8 @@ typedef enum tagUsbSupported {
|
||||||
UPDATE_SCAN_PARAMETER = 72,
|
UPDATE_SCAN_PARAMETER = 72,
|
||||||
// PC繁忙或出错
|
// PC繁忙或出错
|
||||||
PC_SCAN_BUSY_or_ERROR = 73,
|
PC_SCAN_BUSY_or_ERROR = 73,
|
||||||
|
//ß¡½Ç
|
||||||
|
DOG_EAR=74,
|
||||||
//USB 未连接
|
//USB 未连接
|
||||||
USB_DISCONNECTED = 200,
|
USB_DISCONNECTED = 200,
|
||||||
//用户点击停止
|
//用户点击停止
|
||||||
|
@ -86,6 +89,7 @@ public:
|
||||||
void ResetMsgFiter() { bFilterMsg = true; }
|
void ResetMsgFiter() { bFilterMsg = true; }
|
||||||
virtual void open(int vid, int pid) = 0;
|
virtual void open(int vid, int pid) = 0;
|
||||||
virtual void regist_deviceevent_callback(deviceevent_callback callback, void* usrdata = 0) = 0;
|
virtual void regist_deviceevent_callback(deviceevent_callback callback, void* usrdata = 0) = 0;
|
||||||
|
virtual void DogEar_callback(std::function<void(int)> fun)=0;
|
||||||
virtual int aquire_bmpdata(std::vector<unsigned char>& bmpdata) = 0;
|
virtual int aquire_bmpdata(std::vector<unsigned char>& bmpdata) = 0;
|
||||||
virtual BOOL IsConnected() = 0;
|
virtual BOOL IsConnected() = 0;
|
||||||
virtual std::string GetFWVersion() = 0;
|
virtual std::string GetFWVersion() = 0;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "StopWatch.h"
|
#include "StopWatch.h"
|
||||||
#include "scn_config.h"
|
#include "scn_config.h"
|
||||||
#include "ImageMatQueue.h"
|
#include "ImageMatQueue.h"
|
||||||
|
#include "ImageProcess/ImageApplyDogEarDetection.h"
|
||||||
#include "filetools.h"
|
#include "filetools.h"
|
||||||
#include "GetMemoryUsage.h"
|
#include "GetMemoryUsage.h"
|
||||||
#ifndef G200
|
#ifndef G200
|
||||||
|
@ -143,9 +144,11 @@ typedef enum tagUsbKeyWords : UINT32
|
||||||
|
|
||||||
GScanO200::GScanO200() :
|
GScanO200::GScanO200() :
|
||||||
huagods(NULL),
|
huagods(NULL),
|
||||||
|
image_num(0),
|
||||||
m_bread_fixed_ratio_fromDSP(false)
|
m_bread_fixed_ratio_fromDSP(false)
|
||||||
{
|
{
|
||||||
m_pImages.reset(new ImageMatQueue());
|
m_pImages.reset(new ImageMatQueue());
|
||||||
|
m_pImages->Getimagenumber = std::bind(&GScanO200::Getimagenumber,this, std::placeholders::_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GScanO200::~GScanO200()
|
GScanO200::~GScanO200()
|
||||||
|
@ -160,6 +163,25 @@ GScanO200::~GScanO200()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GScanO200::Getimagenumber(bool isadd)
|
||||||
|
{
|
||||||
|
if (isadd)
|
||||||
|
{
|
||||||
|
image_num++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image_num--;
|
||||||
|
}
|
||||||
|
//FileTools::write_log("1.txt", "image num :" + std::to_string(image_num));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GScanO200::DogEar_callback(std::function<void(int)> fun)
|
||||||
|
{
|
||||||
|
m_pImages->DogEarDetection_callback = fun;
|
||||||
|
}
|
||||||
|
|
||||||
void GScanO200::open(int vid, int pid)
|
void GScanO200::open(int vid, int pid)
|
||||||
{
|
{
|
||||||
auto usbs = UsbScan_List::find_vid_pid(vid, pid);
|
auto usbs = UsbScan_List::find_vid_pid(vid, pid);
|
||||||
|
@ -175,7 +197,7 @@ void GScanO200::open(int vid, int pid)
|
||||||
ipid = 0x0100;
|
ipid = 0x0100;
|
||||||
#else
|
#else
|
||||||
ivid = 0x3072;
|
ivid = 0x3072;
|
||||||
ipid = 0x0100;
|
ipid = 0x0200;
|
||||||
#endif // ISG100
|
#endif // ISG100
|
||||||
|
|
||||||
#elif defined(G300)
|
#elif defined(G300)
|
||||||
|
@ -401,7 +423,7 @@ void GScanO200::Scanner_StartScan(UINT16 count)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // !G200
|
#endif // !G200
|
||||||
|
m_pImages->reset_DogEar();
|
||||||
if (gcap.is_duplex)
|
if (gcap.is_duplex)
|
||||||
count = count == 65535 ? 65535 : count / 2;
|
count = count == 65535 ? 65535 : count / 2;
|
||||||
USBCB usbcb = { START_COMMAND,(UINT32)count ,0 };
|
USBCB usbcb = { START_COMMAND,(UINT32)count ,0 };
|
||||||
|
@ -586,8 +608,8 @@ void GScanO200::usbmain()
|
||||||
writelog("imgData->size() error");
|
writelog("imgData->size() error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(!m_pImages->get_isDogEar())
|
||||||
m_pImages->pushMat(std::shared_ptr<IDecode>(new G200Decode(imgData)));
|
m_pImages->pushMat(std::shared_ptr<IDecode>(new G200Decode(imgData)));
|
||||||
//static int rawdataindex = 0;
|
//static int rawdataindex = 0;
|
||||||
//writelog("origin rawbuffer index " + std::to_string(++rawdataindex));
|
//writelog("origin rawbuffer index " + std::to_string(++rawdataindex));
|
||||||
#ifdef LOG_NORMAL
|
#ifdef LOG_NORMAL
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
virtual void Set_ErrorCode(UINT32 value) override;
|
virtual void Set_ErrorCode(UINT32 value) override;
|
||||||
virtual int get_scanned_num() override;
|
virtual int get_scanned_num() override;
|
||||||
virtual void clear_hwerror() override;
|
virtual void clear_hwerror() override;
|
||||||
|
virtual void DogEar_callback(std::function<void(int)> fun) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void usbhotplug_callback(bool isleft, void* userdata);
|
static void usbhotplug_callback(bool isleft, void* userdata);
|
||||||
|
@ -41,6 +42,7 @@ private:
|
||||||
void updateHVRatio();
|
void updateHVRatio();
|
||||||
void usbmain();
|
void usbmain();
|
||||||
USBCB Get_Scanner_Status();
|
USBCB Get_Scanner_Status();
|
||||||
|
void Getimagenumber(bool isadd);
|
||||||
std::shared_ptr<std::vector<char>> Get_Img_Data(int buffersize);
|
std::shared_ptr<std::vector<char>> Get_Img_Data(int buffersize);
|
||||||
void Pop_Image();
|
void Pop_Image();
|
||||||
private:
|
private:
|
||||||
|
@ -48,6 +50,7 @@ private:
|
||||||
std::shared_ptr<IUsb> m_usb;
|
std::shared_ptr<IUsb> m_usb;
|
||||||
std::unique_ptr<thread> m_threadUsb;
|
std::unique_ptr<thread> m_threadUsb;
|
||||||
GScanCap gcap;
|
GScanCap gcap;
|
||||||
|
volatile int image_num;
|
||||||
void* huagods;
|
void* huagods;
|
||||||
deviceevent_callback dev_callback;
|
deviceevent_callback dev_callback;
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,7 @@ static std::map<float, unsigned int> SupResolutions = {
|
||||||
{200.0f, 1},
|
{200.0f, 1},
|
||||||
{240.0f, 1},
|
{240.0f, 1},
|
||||||
{300.0f, 0},
|
{300.0f, 0},
|
||||||
{600.0f, 2}
|
{600.0f, 1} //临时版本发1 原来发2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,11 @@ ImageMatQueue::ImageMatQueue(void)
|
||||||
, is_scanning(false)
|
, is_scanning(false)
|
||||||
,fx(1.001)
|
,fx(1.001)
|
||||||
,fy(1.007)
|
,fy(1.007)
|
||||||
|
,DogEar_index(0)
|
||||||
|
,is_DogEar(false)
|
||||||
{
|
{
|
||||||
atm_orgin_image_remains = 0;
|
atm_orgin_image_remains = 0;
|
||||||
|
m_dogear.reset(new CImageApplyDogEarDetection(40,1.0,200));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageMatQueue::run()
|
void ImageMatQueue::run()
|
||||||
|
@ -62,6 +65,17 @@ void ImageMatQueue::run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImageMatQueue::get_isDogEar()
|
||||||
|
{
|
||||||
|
return is_DogEar;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageMatQueue::reset_DogEar()
|
||||||
|
{
|
||||||
|
is_DogEar = false;
|
||||||
|
DogEar_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ImageMatQueue::orginimgcount()
|
int ImageMatQueue::orginimgcount()
|
||||||
{
|
{
|
||||||
return atm_orgin_image_remains;
|
return atm_orgin_image_remains;
|
||||||
|
@ -95,6 +109,7 @@ ImageMatQueue::~ImageMatQueue(void)
|
||||||
static int paperIndex = 0;
|
static int paperIndex = 0;
|
||||||
void ImageMatQueue::pushMat(std::shared_ptr<IDecode> data)
|
void ImageMatQueue::pushMat(std::shared_ptr<IDecode> data)
|
||||||
{
|
{
|
||||||
|
Getimagenumber(true);
|
||||||
m_rawBuffs.Put(data);
|
m_rawBuffs.Put(data);
|
||||||
atm_orgin_image_remains++;
|
atm_orgin_image_remains++;
|
||||||
//string paperindexinfo = "Get the index of "+to_string(++paperIndex)+" Paper";
|
//string paperindexinfo = "Get the index of "+to_string(++paperIndex)+" Paper";
|
||||||
|
@ -118,9 +133,15 @@ void ImageMatQueue::clear()
|
||||||
atm_orgin_image_remains = 0;
|
atm_orgin_image_remains = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageMatQueue::rawBuffsclear()
|
||||||
|
{
|
||||||
|
m_rawBuffs.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
void ImageMatQueue::setparam(const GScanCap& param)
|
void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
{
|
{
|
||||||
paperIndex = 0;
|
paperIndex = 0;
|
||||||
|
ischeck_dogear = param.is_dogeardetection;
|
||||||
//FileTools::write_log("D:\\1.txt", "RESET PAPER COUNT");
|
//FileTools::write_log("D:\\1.txt", "RESET PAPER COUNT");
|
||||||
scanParam = param;
|
scanParam = param;
|
||||||
//scanParam.is_duplex = 0;
|
//scanParam.is_duplex = 0;
|
||||||
|
@ -154,6 +175,48 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
}
|
}
|
||||||
|
|
||||||
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()));
|
||||||
|
CImageApplyDiscardBlank* disBlank = new CImageApplyDiscardBlank();
|
||||||
|
//跳过空白页阈值
|
||||||
|
int area = 200;
|
||||||
|
int intensity = 15;
|
||||||
|
int maxHeight = 3307;//A3 height
|
||||||
|
//页面最大高度获取
|
||||||
|
if (param.papertype == TwSS::MaxSize)
|
||||||
|
maxHeight = 6614;
|
||||||
|
//阈值参数赋值
|
||||||
|
if (param.discardblank_percent < 10) {
|
||||||
|
area = 70 + (int)((param.discardblank_percent - 1) * 13.33);
|
||||||
|
intensity = 8 + param.discardblank_percent / 2;
|
||||||
|
}
|
||||||
|
else if (param.discardblank_percent < 20) {
|
||||||
|
area = 190 + (param.discardblank_percent - 10) * 14;
|
||||||
|
intensity = 15;
|
||||||
|
}
|
||||||
|
else if (param.discardblank_percent < 40) {
|
||||||
|
area = 400 + (param.discardblank_percent - 20) * 10;
|
||||||
|
intensity = 20;
|
||||||
|
}
|
||||||
|
else if (param.discardblank_percent < 60) {
|
||||||
|
area = 600 + (param.discardblank_percent - 40) * 20;
|
||||||
|
intensity = 20;
|
||||||
|
}
|
||||||
|
else if (param.discardblank_percent < 80) {
|
||||||
|
area = 1000 + (param.discardblank_percent - 60) * 55;
|
||||||
|
intensity = 30;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
area = 2100 + (param.discardblank_percent - 80) * (maxHeight - 2100) / 20;
|
||||||
|
intensity = 40;
|
||||||
|
}
|
||||||
|
//判断是否为跳过空白页发票
|
||||||
|
if (param.is_autodiscradblank_vince) {
|
||||||
|
area *= 1.5;
|
||||||
|
intensity *= 1.5;
|
||||||
|
}
|
||||||
|
//设置参数阈值
|
||||||
|
disBlank->setMinArea(area);
|
||||||
|
disBlank->setIntensity(intensity);
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank()));
|
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank()));
|
||||||
//m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank(param.areanum,param.devnmax)));
|
//m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank(param.areanum,param.devnmax)));
|
||||||
}
|
}
|
||||||
|
@ -226,7 +289,11 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
|
|
||||||
TCHAR szIniFile[MAX_PATH] = { 0 };
|
TCHAR szIniFile[MAX_PATH] = { 0 };
|
||||||
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
|
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
|
||||||
|
#ifdef LANXUM
|
||||||
|
_tcscat(szIniFile, _T("\\twain_32\\LANXUMSCAN\\tessdata"));
|
||||||
|
#else
|
||||||
_tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\tessdata"));
|
_tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\tessdata"));
|
||||||
|
#endif //
|
||||||
int iLen = WideCharToMultiByte(CP_ACP, 0, szIniFile, -1, NULL, 0, NULL, NULL);
|
int iLen = WideCharToMultiByte(CP_ACP, 0, szIniFile, -1, NULL, 0, NULL, NULL);
|
||||||
char* chRtn = new char[iLen * sizeof(char)];
|
char* chRtn = new char[iLen * sizeof(char)];
|
||||||
WideCharToMultiByte(CP_ACP, 0, szIniFile, -1, chRtn, iLen, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, szIniFile, -1, chRtn, iLen, NULL, NULL);
|
||||||
|
@ -242,16 +309,17 @@ void ImageMatQueue::EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>>
|
||||||
void ImageMatQueue::PaniusCount()
|
void ImageMatQueue::PaniusCount()
|
||||||
{
|
{
|
||||||
atm_orgin_image_remains--;
|
atm_orgin_image_remains--;
|
||||||
|
Getimagenumber(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImageMatQueue::empty()
|
bool ImageMatQueue::empty()
|
||||||
{
|
{
|
||||||
return atm_orgin_image_remains == 0 && m_imagedata.Size() == 0 && !is_scanning;
|
return atm_orgin_image_remains <= 0 && m_imagedata.Size() == 0 && !is_scanning;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImageMatQueue::queuesempty()
|
bool ImageMatQueue::queuesempty()
|
||||||
{
|
{
|
||||||
return atm_orgin_image_remains == 0 && m_imagedata.Size() == 0;
|
return atm_orgin_image_remains <= 0 && m_imagedata.Size() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int index = 0;
|
static int index = 0;
|
||||||
|
@ -312,7 +380,22 @@ void ImageMatQueue::proc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffs.clear();
|
buffs.clear();
|
||||||
|
DogEar_index++;
|
||||||
|
StopWatch sw;
|
||||||
|
sw.reset();
|
||||||
|
if (ischeck_dogear)
|
||||||
|
{
|
||||||
|
m_dogear->apply(mats[0], 0);
|
||||||
|
if (m_dogear->getResult())
|
||||||
|
{
|
||||||
|
DogEarDetection_callback(DogEar_index);
|
||||||
|
m_rawBuffs.Clear();
|
||||||
|
atm_orgin_image_remains = 0;
|
||||||
|
is_DogEar = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//FileTools::write_log("1.txt", " dogear time " + to_string(sw.elapsed_ms()));
|
||||||
if (scanParam.is_switchfrontback)
|
if (scanParam.is_switchfrontback)
|
||||||
swap(mats[0], mats[1]);
|
swap(mats[0], mats[1]);
|
||||||
|
|
||||||
|
@ -332,8 +415,11 @@ void ImageMatQueue::proc()
|
||||||
if (mats[i].channels() == 3)
|
if (mats[i].channels() == 3)
|
||||||
cvtColor(mats[i], mats[i], cv::COLOR_BGR2GRAY);
|
cvtColor(mats[i], mats[i], cv::COLOR_BGR2GRAY);
|
||||||
idata = scanParam.pixtype == 0 ? (IMat2Bmp)Mat2BmpBw(mats[i], scanParam.resolution_dst) : Mat2Bmp(mats[i], scanParam.resolution_dst);
|
idata = scanParam.pixtype == 0 ? (IMat2Bmp)Mat2BmpBw(mats[i], scanParam.resolution_dst) : Mat2Bmp(mats[i], scanParam.resolution_dst);
|
||||||
|
if (!scanParam.multi_output_red)
|
||||||
|
mats[i].release();
|
||||||
auto data = idata.getBmpDataBuffer();
|
auto data = idata.getBmpDataBuffer();
|
||||||
EnqueueBmpBuffer(data);
|
EnqueueBmpBuffer(data);
|
||||||
|
data.reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -356,6 +442,7 @@ void ImageMatQueue::proc()
|
||||||
auto data = mb.getBmpDataBuffer();
|
auto data = mb.getBmpDataBuffer();
|
||||||
ret.release();
|
ret.release();
|
||||||
EnqueueBmpBuffer(data);
|
EnqueueBmpBuffer(data);
|
||||||
|
data.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,24 +161,33 @@ public:
|
||||||
bool empty();
|
bool empty();
|
||||||
bool queuesempty();
|
bool queuesempty();
|
||||||
bool valid();
|
bool valid();
|
||||||
|
bool get_isDogEar();
|
||||||
|
void reset_DogEar();
|
||||||
void clear();
|
void clear();
|
||||||
|
void rawBuffsclear();
|
||||||
void setparam(const GScanCap& param);
|
void setparam(const GScanCap& param);
|
||||||
void run();
|
void run();
|
||||||
int orginimgcount();
|
int orginimgcount();
|
||||||
void setscanflags(const bool flags) { is_scanning = flags; }
|
void setscanflags(const bool flags) { is_scanning = flags; }
|
||||||
void updatefixratio(float& hratio, float& vratio);
|
void updatefixratio(float& hratio, float& vratio);
|
||||||
|
std::function<void(int)> DogEarDetection_callback;
|
||||||
|
std::function<void(bool)> Getimagenumber;
|
||||||
private:
|
private:
|
||||||
void proc();
|
void proc();
|
||||||
void EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>>);
|
void EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>>);
|
||||||
void PaniusCount();
|
void PaniusCount();
|
||||||
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>>m_imagedata;
|
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>>m_imagedata;
|
||||||
std::unique_ptr<thread> m_threadProc;
|
std::unique_ptr<thread> m_threadProc;
|
||||||
|
bool ischeck_dogear;
|
||||||
|
volatile int DogEar_index;
|
||||||
|
volatile bool is_DogEar;
|
||||||
volatile bool bRun;
|
volatile bool bRun;
|
||||||
volatile int atm_orgin_image_remains;
|
volatile int atm_orgin_image_remains;
|
||||||
volatile bool is_scanning;
|
volatile bool is_scanning;
|
||||||
GScanCap scanParam;
|
GScanCap scanParam;
|
||||||
Device::PaperSize papersize;
|
Device::PaperSize papersize;
|
||||||
std::vector<std::shared_ptr<CImageApply>> m_iaList;
|
std::shared_ptr<CImageApplyDogEarDetection> m_dogear;
|
||||||
|
std::vector<std::shared_ptr<CImageApply>> m_iaList; //ͼÏñ´¦Àíº¯Êý½Ó¿Ú
|
||||||
BlockingQueue<std::shared_ptr<IDecode>> m_rawBuffs;
|
BlockingQueue<std::shared_ptr<IDecode>> m_rawBuffs;
|
||||||
float fx, fy;
|
float fx, fy;
|
||||||
};
|
};
|
|
@ -437,6 +437,8 @@ CString GetHidedlgPath()
|
||||||
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
|
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
|
||||||
#ifdef MAKEHUAGAO
|
#ifdef MAKEHUAGAO
|
||||||
_tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\hidedlg.exe"));
|
_tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\hidedlg.exe"));
|
||||||
|
#elif defined LANXUM
|
||||||
|
_tcscat(szIniFile, _T("\\twain_32\\LANXUMSCAN\\hidedlg.exe"));
|
||||||
#else // MAKEHUAGAO
|
#else // MAKEHUAGAO
|
||||||
_tcscat(szIniFile, _T("\\twain_32\\ZhibenScan\\hidedlg.exe"));
|
_tcscat(szIniFile, _T("\\twain_32\\ZhibenScan\\hidedlg.exe"));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,6 +59,7 @@ using namespace std;
|
||||||
#define DOCORIENTATION "bOrientation"
|
#define DOCORIENTATION "bOrientation"
|
||||||
#define AUTO_TEXT "bAutoText"
|
#define AUTO_TEXT "bAutoText"
|
||||||
#define BACKROTATE180 "iBackRotate180"
|
#define BACKROTATE180 "iBackRotate180"
|
||||||
|
#define DOGEAR_DETECTION "dogeardetection"
|
||||||
#define SCREWDETECT "bScrewDetect"
|
#define SCREWDETECT "bScrewDetect"
|
||||||
#define SCREWLEVEL "iScrewLevel"
|
#define SCREWLEVEL "iScrewLevel"
|
||||||
#define ITEMCAPTION "Caption"
|
#define ITEMCAPTION "Caption"
|
||||||
|
@ -180,6 +181,7 @@ struct GScanCap
|
||||||
byte is_autocontrast; /**< 自动对比度*/
|
byte is_autocontrast; /**< 自动对比度*/
|
||||||
byte is_autocrop; /**< 自动裁切*/
|
byte is_autocrop; /**< 自动裁切*/
|
||||||
byte is_autodiscradblank_normal; /**< 自动丢弃空白页通用*/
|
byte is_autodiscradblank_normal; /**< 自动丢弃空白页通用*/
|
||||||
|
int discardblank_percent; /**<跳过空白页阀值*/
|
||||||
byte is_autodiscradblank_vince;/**自动丢弃空白页发票*/
|
byte is_autodiscradblank_vince;/**自动丢弃空白页发票*/
|
||||||
byte is_switchfrontback; /**交换正反面*/
|
byte is_switchfrontback; /**交换正反面*/
|
||||||
byte autodescrew; /**< 自动纠偏*/
|
byte autodescrew; /**< 自动纠偏*/
|
||||||
|
@ -191,6 +193,7 @@ struct GScanCap
|
||||||
byte fillbackground; /**< 填黑框*/
|
byte fillbackground; /**< 填黑框*/
|
||||||
unsigned short scannum; /**< 扫描张数*/
|
unsigned short scannum; /**< 扫描张数*/
|
||||||
byte is_backrotate180; /**< 背面旋转180*/
|
byte is_backrotate180; /**< 背面旋转180*/
|
||||||
|
byte is_dogeardetection; /**<折角检测*/
|
||||||
HardwareCaps hardwarecaps; /**< 硬件扫描参数*/
|
HardwareCaps hardwarecaps; /**< 硬件扫描参数*/
|
||||||
FillHole fillhole;
|
FillHole fillhole;
|
||||||
byte is_autotext; /**< 自动文本方向识别*/
|
byte is_autotext; /**< 自动文本方向识别*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ GScanCap GscanJsonConfig::GetDefaultGscancapValue()
|
||||||
gcap.autodescrew = TRUE;//自动纠偏 可用
|
gcap.autodescrew = TRUE;//自动纠偏 可用
|
||||||
gcap.enhance_color = EnchaceColor::Enhance_None;//默认不进行颜色增强
|
gcap.enhance_color = EnchaceColor::Enhance_None;//默认不进行颜色增强
|
||||||
gcap.en_fold = FALSE;//默认不对折
|
gcap.en_fold = FALSE;//默认不对折
|
||||||
gcap.fillbackground = FALSE;//默认不填黑框
|
gcap.fillbackground = TRUE;//ĬÈϲ»ÌîºÚ¿ò
|
||||||
gcap.fillhole.is_fillhole = FALSE;
|
gcap.fillhole.is_fillhole = FALSE;
|
||||||
gcap.fillhole.fillholeratio = 10;
|
gcap.fillhole.fillholeratio = 10;
|
||||||
gcap.filter = 3;//对应Filter::None
|
gcap.filter = 3;//对应Filter::None
|
||||||
|
@ -58,6 +58,7 @@ GScanCap GscanJsonConfig::GetDefaultGscancapValue()
|
||||||
gcap.imageRotateDegree = 0.0f;//默认不进行旋转
|
gcap.imageRotateDegree = 0.0f;//默认不进行旋转
|
||||||
gcap.is_autotext = FALSE;
|
gcap.is_autotext = FALSE;
|
||||||
gcap.is_backrotate180 = FALSE;
|
gcap.is_backrotate180 = FALSE;
|
||||||
|
gcap.is_dogeardetection = FALSE;
|
||||||
gcap.scannum = -1;//默认连续扫描
|
gcap.scannum = -1;//默认连续扫描
|
||||||
//gcap.scanrect = { 0 };
|
//gcap.scanrect = { 0 };
|
||||||
|
|
||||||
|
@ -103,6 +104,7 @@ void GscanJsonConfig::SaveGscanCapConfig(const GScanCap & gcap, const std::strin
|
||||||
outJson["Config"].Add(DOCORIENTATION, (int)(gcap.imageRotateDegree));
|
outJson["Config"].Add(DOCORIENTATION, (int)(gcap.imageRotateDegree));
|
||||||
outJson["Config"].Add(AUTO_TEXT, (bool)(gcap.is_autotext),false);
|
outJson["Config"].Add(AUTO_TEXT, (bool)(gcap.is_autotext),false);
|
||||||
outJson["Config"].Add(BACKROTATE180, (bool)(gcap.is_backrotate180), false);
|
outJson["Config"].Add(BACKROTATE180, (bool)(gcap.is_backrotate180), false);
|
||||||
|
outJson["Config"].Add(DOGEAR_DETECTION, (bool)(gcap.is_dogeardetection), false);
|
||||||
outJson["Config"].Add(SCREWDETECT, (bool)(gcap.hardwarecaps.en_skrewdetect), false);
|
outJson["Config"].Add(SCREWDETECT, (bool)(gcap.hardwarecaps.en_skrewdetect), false);
|
||||||
outJson["Config"].Add(SCREWLEVEL, (int)(gcap.hardwarecaps.skrewdetectlevel));
|
outJson["Config"].Add(SCREWLEVEL, (int)(gcap.hardwarecaps.skrewdetectlevel));
|
||||||
outJson["Config"].Add(ITEMCAPTION, (string)(gcap.Caption));
|
outJson["Config"].Add(ITEMCAPTION, (string)(gcap.Caption));
|
||||||
|
@ -155,6 +157,7 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
||||||
root["Config"].AddEmptySubArray(DOCORIENTATION);
|
root["Config"].AddEmptySubArray(DOCORIENTATION);
|
||||||
root["Config"].AddEmptySubArray(AUTO_TEXT);
|
root["Config"].AddEmptySubArray(AUTO_TEXT);
|
||||||
root["Config"].AddEmptySubArray(BACKROTATE180);
|
root["Config"].AddEmptySubArray(BACKROTATE180);
|
||||||
|
root["Config"].AddEmptySubArray(DOGEAR_DETECTION);
|
||||||
root["Config"].AddEmptySubArray(SCREWDETECT);
|
root["Config"].AddEmptySubArray(SCREWDETECT);
|
||||||
root["Config"].AddEmptySubArray(SCREWLEVEL);
|
root["Config"].AddEmptySubArray(SCREWLEVEL);
|
||||||
|
|
||||||
|
@ -197,6 +200,7 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
||||||
root["Config"][DOCORIENTATION].Add((int)cfgArray[i].imageRotateDegree);
|
root["Config"][DOCORIENTATION].Add((int)cfgArray[i].imageRotateDegree);
|
||||||
root["Config"][AUTO_TEXT].Add(i, (bool)cfgArray[i].is_autotext);
|
root["Config"][AUTO_TEXT].Add(i, (bool)cfgArray[i].is_autotext);
|
||||||
root["Config"][BACKROTATE180].Add(i, (bool)cfgArray[i].is_backrotate180);
|
root["Config"][BACKROTATE180].Add(i, (bool)cfgArray[i].is_backrotate180);
|
||||||
|
root["Config"][DOGEAR_DETECTION].Add(i, (bool)cfgArray[i].is_dogeardetection);
|
||||||
root["Config"][SCREWDETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_skrewdetect);
|
root["Config"][SCREWDETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_skrewdetect);
|
||||||
root["Config"][SCREWLEVEL].Add((int)cfgArray[i].hardwarecaps.skrewdetectlevel);
|
root["Config"][SCREWLEVEL].Add((int)cfgArray[i].hardwarecaps.skrewdetectlevel);
|
||||||
|
|
||||||
|
@ -349,6 +353,8 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
root["Config"].Get(AUTO_TEXT, itmAutotext);
|
root["Config"].Get(AUTO_TEXT, itmAutotext);
|
||||||
neb::CJsonObject itmBackRotate;
|
neb::CJsonObject itmBackRotate;
|
||||||
root["Config"].Get(BACKROTATE180, itmBackRotate);
|
root["Config"].Get(BACKROTATE180, itmBackRotate);
|
||||||
|
neb::CJsonObject itmdogeardetection;
|
||||||
|
root["Config"].Get(DOGEAR_DETECTION, itmdogeardetection);
|
||||||
neb::CJsonObject itmScrewDetct;
|
neb::CJsonObject itmScrewDetct;
|
||||||
root["Config"].Get(SCREWDETECT, itmScrewDetct);
|
root["Config"].Get(SCREWDETECT, itmScrewDetct);
|
||||||
neb::CJsonObject itmScrewLevel;
|
neb::CJsonObject itmScrewLevel;
|
||||||
|
@ -437,6 +443,8 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.is_autotext = b_value?1:0;
|
cfp.is_autotext = b_value?1:0;
|
||||||
itmBackRotate.Get(i, b_value);
|
itmBackRotate.Get(i, b_value);
|
||||||
cfp.is_backrotate180 = b_value ? 1 : 0;
|
cfp.is_backrotate180 = b_value ? 1 : 0;
|
||||||
|
itmdogeardetection.Get(i, b_value);
|
||||||
|
cfp.is_dogeardetection = b_value ? 1 : 0;
|
||||||
itmScrewDetct.Get(i, b_value);
|
itmScrewDetct.Get(i, b_value);
|
||||||
cfp.hardwarecaps.en_skrewdetect = b_value ? 1 : 0;
|
cfp.hardwarecaps.en_skrewdetect = b_value ? 1 : 0;
|
||||||
itmScrewLevel.Get(i, i_value);
|
itmScrewLevel.Get(i, i_value);
|
||||||
|
@ -529,6 +537,8 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.is_autotext = bvalue?1:0;
|
cfp.is_autotext = bvalue?1:0;
|
||||||
root["Config"].Get(BACKROTATE180, bvalue);
|
root["Config"].Get(BACKROTATE180, bvalue);
|
||||||
cfp.is_backrotate180 = bvalue ? 1 : 0;
|
cfp.is_backrotate180 = bvalue ? 1 : 0;
|
||||||
|
root["Config"].Get(DOGEAR_DETECTION, bvalue);
|
||||||
|
cfp.is_dogeardetection = bvalue ? 1 : 0;
|
||||||
root["Config"].Get(SCREWDETECT, bvalue);
|
root["Config"].Get(SCREWDETECT, bvalue);
|
||||||
cfp.hardwarecaps.en_skrewdetect = bvalue ? 1 : 0;
|
cfp.hardwarecaps.en_skrewdetect = bvalue ? 1 : 0;
|
||||||
root["Config"].Get(SCREWLEVEL, index);
|
root["Config"].Get(SCREWLEVEL, index);
|
||||||
|
|
|
@ -23,8 +23,7 @@ CImageApplyAdjustColors::~CImageApplyAdjustColors(void)
|
||||||
void CImageApplyAdjustColors::apply(cv::Mat& pDib,int side)
|
void CImageApplyAdjustColors::apply(cv::Mat& pDib,int side)
|
||||||
{
|
{
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
FileTools::
|
FileTools::write_log("imgprc.txt", "enter CImageApplyAdjustColors apply");
|
||||||
"imgprc.txt", "enter CImageApplyAdjustColors apply");
|
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
if (pDib.empty())
|
if (pDib.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,7 +128,10 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
||||||
|
|
||||||
pDib.release();
|
pDib.release();
|
||||||
if ((m_isCrop && side == 0) || (side == 1 && m_fixedSize.width * m_fixedSize.height == 0))
|
if ((m_isCrop && side == 0) || (side == 1 && m_fixedSize.width * m_fixedSize.height == 0))
|
||||||
|
{
|
||||||
pDib = dst.clone();
|
pDib = dst.clone();
|
||||||
|
dst.release();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_isCrop && side == 1 && !m_fixedSize.empty())
|
if (m_isCrop && side == 1 && !m_fixedSize.empty())
|
||||||
|
@ -159,7 +162,8 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
||||||
FileTools::write_log("imgprc.txt", outroiinfo);
|
FileTools::write_log("imgprc.txt", outroiinfo);
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
dst(roi).copyTo(pDib(rect));
|
dst(roi).copyTo(pDib(rect));
|
||||||
|
dst.release();
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply8");
|
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply8");
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
|
|
||||||
cv::Size fixedSize() { return m_fixedSize; }
|
cv::Size fixedSize() { return m_fixedSize; }
|
||||||
|
|
||||||
|
const std::vector<cv::Point>& maxContour() { return m_maxContour; }
|
||||||
|
|
||||||
void setAutoCrop(bool enabled) { m_isCrop = enabled; }
|
void setAutoCrop(bool enabled) { m_isCrop = enabled; }
|
||||||
|
|
||||||
void setFillBlank(bool enabled) { m_isFillBlank = enabled; }
|
void setFillBlank(bool enabled) { m_isFillBlank = enabled; }
|
||||||
|
@ -58,7 +60,7 @@ private:
|
||||||
int m_noise;
|
int m_noise;
|
||||||
int m_indent;
|
int m_indent;
|
||||||
cv::Size m_fixedSize;
|
cv::Size m_fixedSize;
|
||||||
|
std::vector<cv::Point> m_maxContour;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !IMAGE_APPLY_AUTO_CROP_H
|
#endif // !IMAGE_APPLY_AUTO_CROP_H
|
||||||
|
|
|
@ -86,8 +86,7 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
FileTools::
|
FileTools::write_log("imgprc.txt", "exit CImageApplyBWBinaray apply");
|
||||||
"imgprc.txt", "exit CImageApplyBWBinaray apply");
|
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ CImageApplyChannel::~CImageApplyChannel(void)
|
||||||
void CImageApplyChannel::apply(cv::Mat& pDib,int side)
|
void CImageApplyChannel::apply(cv::Mat& pDib,int side)
|
||||||
{
|
{
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
FileTools::
|
FileTools::write_log("imgprc.txt", "enter CImageApplyChannel apply");
|
||||||
"imgprc.txt", "enter CImageApplyChannel apply");
|
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
|
|
||||||
if (pDib.empty())
|
if (pDib.empty())
|
||||||
|
|
|
@ -119,8 +119,7 @@ cv::Mat CImageApplyDiscardBlank::getRoiMat(const cv::Mat& image)
|
||||||
void CImageApplyDiscardBlank::apply(cv::Mat& pDib, int side)
|
void CImageApplyDiscardBlank::apply(cv::Mat& pDib, int side)
|
||||||
{
|
{
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
FileTools::
|
FileTools::write_log("imgprc.txt", "enter CImageApplyDiscardBlank apply");
|
||||||
"imgprc.txt", "enter CImageApplyDiscardBlank apply");
|
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
|
|
||||||
if (pDib.empty())
|
if (pDib.empty())
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#include "ImageApplyDogEarDetection.h"
|
||||||
|
#include "ImageProcess_Public.h"
|
||||||
|
|
||||||
|
CImageApplyDogEarDetection::CImageApplyDogEarDetection()
|
||||||
|
: m_threshold(40)
|
||||||
|
, m_zoom(1.0)
|
||||||
|
, m_distance(50)
|
||||||
|
, m_result(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CImageApplyDogEarDetection::CImageApplyDogEarDetection(double threshlod, double zoom, double distance)
|
||||||
|
: m_threshold(threshlod)
|
||||||
|
, m_zoom(zoom)
|
||||||
|
, m_distance(distance)
|
||||||
|
, m_result(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CImageApplyDogEarDetection::~CImageApplyDogEarDetection()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CImageApplyDogEarDetection::apply(cv::Mat &pDib, int side)
|
||||||
|
{
|
||||||
|
m_result = false;
|
||||||
|
(void)side;
|
||||||
|
if (pDib.empty()) return;
|
||||||
|
cv::Mat src;
|
||||||
|
if (m_zoom != 1.0)
|
||||||
|
cv::resize(pDib, src, cv::Size(), m_zoom, m_zoom, cv::INTER_NEAREST);
|
||||||
|
else
|
||||||
|
src = pDib;
|
||||||
|
|
||||||
|
cv::Mat thre;
|
||||||
|
hg::threshold_Mat(src, thre, m_threshold);
|
||||||
|
std::vector<cv::Vec4i> hierarchy;
|
||||||
|
std::vector<std::vector<cv::Point>> contours;
|
||||||
|
hg::findContours(thre, contours, hierarchy, cv::RETR_EXTERNAL);
|
||||||
|
|
||||||
|
std::vector<cv::Point> maxContour = hg::getMaxContour(contours, hierarchy);
|
||||||
|
if (maxContour.size() == 0)
|
||||||
|
{
|
||||||
|
m_result = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hg::convexHull(maxContour, maxContour);
|
||||||
|
cv::RotatedRect rect = hg::getBoundingRect(maxContour);
|
||||||
|
cv::Point2f vertexes[4];
|
||||||
|
rect.points(vertexes);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
if ((-cv::pointPolygonTest(maxContour, vertexes[i], true)) > (m_distance * m_zoom))
|
||||||
|
{
|
||||||
|
m_result = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CImageApplyDogEarDetection::apply(std::vector<cv::Mat> &mats, bool isTwoSide)
|
||||||
|
{
|
||||||
|
(void)mats;
|
||||||
|
(void)isTwoSide;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* ====================================================
|
||||||
|
|
||||||
|
* 功能:折角检测。检测原理:计算纸张的理论四角顶点,到实际轮廓最小距离。当任意顶点到轮廓最小距离超过阈值,则判定为折角
|
||||||
|
* 作者:刘丁维
|
||||||
|
* 生成时间:2020/10/30
|
||||||
|
* 最近修改时间:2020/10/30
|
||||||
|
* 版本号:v1.0
|
||||||
|
|
||||||
|
* ====================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef IMAGE_APPLY_DOGEAR_DETECTION_H
|
||||||
|
#define IMAGE_APPLY_DOGEAR_DETECTION_H
|
||||||
|
|
||||||
|
#include "ImageApply.h"
|
||||||
|
|
||||||
|
class CImageApplyDogEarDetection :public CImageApply
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 折角检测默认构造函数,threshold = 40, zoom = 1.0, distance = 50
|
||||||
|
/// </summary>
|
||||||
|
CImageApplyDogEarDetection();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 折角检测构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="threshlod">二值化阈值</param>
|
||||||
|
/// <param name="zoom">原图缩放比例,对于大尺寸图像而言通过zoom缩小图像可减少计算量。默认值1.0(不缩放)</param>
|
||||||
|
/// <param name="distance">理论顶点到实际轮廓最小距离的阈值,大于该阈值则判定为折角,默认值50(像素)</param>
|
||||||
|
CImageApplyDogEarDetection(double threshlod, double zoom = 1.0, double distance = 50);
|
||||||
|
|
||||||
|
virtual ~CImageApplyDogEarDetection(void);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取检测结果。该函数须在调用apply之后使用。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true为折角,false为不折角</returns>
|
||||||
|
inline bool getResult() { return m_result; }
|
||||||
|
|
||||||
|
virtual void apply(cv::Mat& pDib, int side);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double m_threshold;
|
||||||
|
double m_zoom;
|
||||||
|
double m_distance;
|
||||||
|
|
||||||
|
bool m_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMAGE_APPLY_DOGEAR_DETECTION_H
|
|
@ -9,6 +9,7 @@
|
||||||
#include "ImageApplyCrop.h"
|
#include "ImageApplyCrop.h"
|
||||||
#include "ImageApplyDiscardBlank.h"
|
#include "ImageApplyDiscardBlank.h"
|
||||||
#include "ImageApplyOutHole.h"
|
#include "ImageApplyOutHole.h"
|
||||||
|
#include "ImageApplyDogEarDetection.h"
|
||||||
#include "ImageApplyResize.h"
|
#include "ImageApplyResize.h"
|
||||||
#include "ImageApplyRotation.h"
|
#include "ImageApplyRotation.h"
|
||||||
#include "ImageApplySharpen.h"
|
#include "ImageApplySharpen.h"
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#endif // EXTENSION_DLL
|
#endif // EXTENSION_DLL
|
||||||
|
|
||||||
#endif // AfxExt
|
#endif // AfxExt
|
||||||
|
#include <afxcmn.h>
|
||||||
|
|
||||||
class AfxExt CSmartEdit;
|
class AfxExt CSmartEdit;
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,14 @@ void CTabPageSSL::OnOK (void) {
|
||||||
//
|
//
|
||||||
// Prevent CDialog::OnOK from calling EndDialog.
|
// Prevent CDialog::OnOK from calling EndDialog.
|
||||||
//
|
//
|
||||||
|
CDialog::OnOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTabPageSSL::OnCancel (void) {
|
void CTabPageSSL::OnCancel (void) {
|
||||||
//
|
//
|
||||||
// Prevent CDialog::OnCancel from calling EndDialog.
|
// Prevent CDialog::OnCancel from calling EndDialog.
|
||||||
//
|
//
|
||||||
|
CDialog::OnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CTabPageSSL::OnCommand (WPARAM wParam, LPARAM lParam) {
|
BOOL CTabPageSSL::OnCommand (WPARAM wParam, LPARAM lParam) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CTabPageSSL declaration
|
// CTabPageSSL declaration
|
||||||
|
#include <afxdlgs.h>
|
||||||
class CTabPageSSL : public CDialog
|
class CTabPageSSL : public CDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -43,7 +43,8 @@ enum class CapTypeEx : unsigned short {
|
||||||
TwEx_StableDetectEnable = 0x8090,
|
TwEx_StableDetectEnable = 0x8090,
|
||||||
TwEx_UVModel = 0x8093,
|
TwEx_UVModel = 0x8093,
|
||||||
TwEx_SwitchFrontBack = 0x8094,
|
TwEx_SwitchFrontBack = 0x8094,
|
||||||
TwEx_HsvCorrect = 0x8095
|
TwEx_HsvCorrect = 0x8095,
|
||||||
|
TwEx_DogEarDelection=0x8096,
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace Twpp;
|
using namespace Twpp;
|
||||||
|
@ -68,6 +69,8 @@ static constexpr const Identity srcIdent(
|
||||||
DataGroup::Image,
|
DataGroup::Image,
|
||||||
#ifdef MAKEHUAGAO
|
#ifdef MAKEHUAGAO
|
||||||
"HUAGO",
|
"HUAGO",
|
||||||
|
#elif defined LANXUM
|
||||||
|
"LANXUM",
|
||||||
#else // MAKEHUAGAO
|
#else // MAKEHUAGAO
|
||||||
"ZHIBEN",
|
"ZHIBEN",
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,7 +82,12 @@ static constexpr const Identity srcIdent(
|
||||||
"G200 Series",
|
"G200 Series",
|
||||||
#endif
|
#endif
|
||||||
#elif defined(G300) // G200
|
#elif defined(G300) // G200
|
||||||
"G300 Series",
|
#ifdef LANXUM
|
||||||
|
"G4260F Series",
|
||||||
|
#else // ISG100
|
||||||
|
"G300 Series",
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif defined(G400) // G200
|
#elif defined(G400) // G200
|
||||||
"G400 Series",
|
"G400 Series",
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,11 +106,13 @@ static constexpr const Identity srcIdent(
|
||||||
"HUAGOSCAN G200 TWAIN"
|
"HUAGOSCAN G200 TWAIN"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#elif defined(G300) // G200
|
#elif defined G300 // G200
|
||||||
#ifndef MAKEHUAGAO
|
#ifdef MAKEHUAGAO
|
||||||
"ZhibenScan G300 TWAIN"
|
|
||||||
#else // !MAKEHUAGAO
|
|
||||||
"HUAGOSCAN G300 TWAIN"
|
"HUAGOSCAN G300 TWAIN"
|
||||||
|
#elif defined LANXUM //!LANXUM
|
||||||
|
"LANXUM G4260F TWAIN"
|
||||||
|
#else // !MAKEHUAGAO
|
||||||
|
"ZhibenScan G300 TWAIN"
|
||||||
#endif
|
#endif
|
||||||
#elif defined(G400) // G200
|
#elif defined(G400) // G200
|
||||||
#ifndef MAKEHUAGAO
|
#ifndef MAKEHUAGAO
|
||||||
|
@ -126,13 +136,24 @@ static constexpr UInt32 RESOLUTIONX = 85;
|
||||||
|
|
||||||
//static std::unique_ptr<CWinApp> application(new CWinApp());
|
//static std::unique_ptr<CWinApp> application(new CWinApp());
|
||||||
|
|
||||||
static list<float> resList = { 100.0,150.0,200.0,240.0,300.0 };
|
static list<float> resList = { 100.0,150.0,200.0,240.0,300.0,600.0 };
|
||||||
|
//Çø·ÖG200 G300¡¢G400Ö½ÕÅ·ùÃæ
|
||||||
|
#ifdef G200
|
||||||
|
|
||||||
static list<UInt16> paperSizeList = { (UInt16)PaperSize::A3,(UInt16)PaperSize::A4,(UInt16)PaperSize::A5,(UInt16)PaperSize::A6,
|
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::IsoB4,(UInt16)PaperSize::IsoB5,(UInt16)PaperSize::IsoB6,
|
||||||
(UInt16)PaperSize::UsLetter,(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::UsLedger,
|
(UInt16)PaperSize::UsLetter,(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::UsLedger,
|
||||||
(UInt16)PaperSize::MaxSize,(UInt16)Twpp::PaperSize::None,(UInt16)PaperSize::UsStatement };
|
(UInt16)PaperSize::MaxSize,(UInt16)PaperSize::None,(UInt16)PaperSize::UsStatement };
|
||||||
|
|
||||||
|
#elif defined G300
|
||||||
|
static list<UInt16> paperSizeList = { (UInt16)PaperSize::A4,(UInt16)PaperSize::A5,(UInt16)PaperSize::A6, (UInt16)PaperSize::IsoB5,(UInt16)PaperSize::IsoB6,
|
||||||
|
(UInt16)PaperSize::UsLetter,(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::None };
|
||||||
|
#elif defined G400
|
||||||
|
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::MaxSize,(UInt16)PaperSize::None,(UInt16)PaperSize::UsStatement };
|
||||||
|
#endif // G200
|
||||||
static list<float> imageRotateList = { 0.0,90.0,180.0,270.0 };
|
static list<float> imageRotateList = { 0.0,90.0,180.0,270.0 };
|
||||||
|
|
||||||
enum class DeviceEventType : UInt16
|
enum class DeviceEventType : UInt16
|
||||||
|
@ -146,7 +167,8 @@ enum class DeviceEventType : UInt16
|
||||||
Dev_COUNTMOE,
|
Dev_COUNTMOE,
|
||||||
Dev_HARDWAREERROR,
|
Dev_HARDWAREERROR,
|
||||||
Dev_FPGAERROR,
|
Dev_FPGAERROR,
|
||||||
Dev_UserStop
|
Dev_UserStop,
|
||||||
|
Dev_DogEar
|
||||||
};
|
};
|
||||||
|
|
||||||
static map<unsigned int, DeviceEvent::Type> mapDeviceEvent = {
|
static map<unsigned int, DeviceEvent::Type> mapDeviceEvent = {
|
||||||
|
@ -161,7 +183,8 @@ static map<unsigned int, DeviceEvent::Type> mapDeviceEvent = {
|
||||||
{HARDWARE_ERROR,(DeviceEvent::Type)(DeviceEventType::Dev_HARDWAREERROR)},
|
{HARDWARE_ERROR,(DeviceEvent::Type)(DeviceEventType::Dev_HARDWAREERROR)},
|
||||||
{FPGA_ERROR,(DeviceEvent::Type)(DeviceEventType::Dev_FPGAERROR)},
|
{FPGA_ERROR,(DeviceEvent::Type)(DeviceEventType::Dev_FPGAERROR)},
|
||||||
{USB_DISCONNECTED,DeviceEvent::Type::CheckDeviceOnline},
|
{USB_DISCONNECTED,DeviceEvent::Type::CheckDeviceOnline},
|
||||||
{USER_STOP,(DeviceEvent::Type)(DeviceEventType::Dev_UserStop)}
|
{USER_STOP,(DeviceEvent::Type)(DeviceEventType::Dev_UserStop)},
|
||||||
|
{DOG_EAR,(DeviceEvent::Type)(DeviceEventType::Dev_DogEar)}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void DeleteWnd(CDialog* pWnd) {
|
static void DeleteWnd(CDialog* pWnd) {
|
||||||
|
@ -186,6 +209,7 @@ static std::unique_ptr<IScanner> scanner(new GScanVirtual());
|
||||||
#endif
|
#endif
|
||||||
HuagaoDs::HuagaoDs()
|
HuagaoDs::HuagaoDs()
|
||||||
: m_scanparam(new GScanCap)
|
: m_scanparam(new GScanCap)
|
||||||
|
,bmpData(new std::vector<unsigned char>)
|
||||||
, hMutex(NULL)
|
, hMutex(NULL)
|
||||||
{
|
{
|
||||||
/*string ss1= getOSInfo();
|
/*string ss1= getOSInfo();
|
||||||
|
@ -464,19 +488,35 @@ void HuagaoDs::SetResoluton(const char* path, int resolution)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HuagaoDs::dogear_callback(int indexpaper)
|
||||||
|
{
|
||||||
|
CString text;
|
||||||
|
text.Format(_T("74 %d"), indexpaper);
|
||||||
|
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), text, NULL, SW_HIDE);
|
||||||
|
scanner->Stop_scan();
|
||||||
|
//scanner->reset();
|
||||||
|
scanner->ResetScanner();
|
||||||
|
onDeviceEvent(DOG_EAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Result HuagaoDs::identityOpenDs(const Identity&) {
|
Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
//writelog("identityOpenDs");
|
//writelog("identityOpenDs");
|
||||||
if(!scanner.get())
|
if(!scanner.get())
|
||||||
scanner.reset(new GScanO200());
|
scanner.reset(new GScanO200());
|
||||||
|
m_haveError = false;
|
||||||
updataGscanCap();
|
updataGscanCap();
|
||||||
bmpData.resize(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER));
|
bmpData->resize(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER));
|
||||||
BITMAPINFOHEADER& bmInfo = *((BITMAPINFOHEADER*)header());
|
BITMAPINFOHEADER& bmInfo = *((BITMAPINFOHEADER*)header());
|
||||||
bmInfo.biHeight = 2000;
|
bmInfo.biHeight = 2000;
|
||||||
bmInfo.biWidth = 2000;
|
bmInfo.biWidth = 2000;
|
||||||
bmInfo.biBitCount = m_scanparam->pixtype == 2 ? 24 : (m_scanparam->pixtype == 1 ? 8 : 0);
|
bmInfo.biBitCount = m_scanparam->pixtype == 2 ? 24 : (m_scanparam->pixtype == 1 ? 8 : 0);
|
||||||
m_iBitdepth = m_scanparam->pixtype == 2 ? 24 : (m_scanparam->pixtype == 1 ? 8 : 0);
|
m_iBitdepth = m_scanparam->pixtype == 2 ? 24 : (m_scanparam->pixtype == 1 ? 8 : 0);
|
||||||
|
#ifdef LANXUM
|
||||||
|
scanner->open(0x31c9, 0x8200);
|
||||||
|
#else
|
||||||
scanner->open(0x064B, 0x7823);
|
scanner->open(0x064B, 0x7823);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!scanner->IsConnected()) {
|
if (!scanner->IsConnected()) {
|
||||||
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString("201"), NULL, SW_HIDE);
|
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString("201"), NULL, SW_HIDE);
|
||||||
|
@ -485,6 +525,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scanner->regist_deviceevent_callback(DeviceEvent_callback, this);
|
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"));
|
hMutex = CreateMutex(NULL, FALSE, _T("LookitApp"));
|
||||||
if (GetLastError() == ERROR_ALREADY_EXISTS) { //如果已经存在同名的Mutex会得到这个错误.
|
if (GetLastError() == ERROR_ALREADY_EXISTS) { //如果已经存在同名的Mutex会得到这个错误.
|
||||||
|
@ -808,10 +849,13 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data = Capability::createEnumeration(data.type(), { PaperSize::A3,PaperSize::A4,PaperSize::A5,
|
data = Capability::createEnumeration(data.type(), { (UInt16)PaperSize::A3,(UInt16)PaperSize::A4,(UInt16)PaperSize::A5,(UInt16)PaperSize::A6,
|
||||||
PaperSize::A6,PaperSize::IsoB4,PaperSize::IsoB5,
|
(UInt16)PaperSize::IsoB5,(UInt16)PaperSize::IsoB6,(UInt16)PaperSize::UsLetter,(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::None
|
||||||
PaperSize::IsoB6,PaperSize::UsLetter,PaperSize::UsLegal,
|
#ifndef G300
|
||||||
PaperSize::UsLedger,PaperSize::MaxSize,PaperSize::None,PaperSize::UsStatement},
|
,(UInt16)PaperSize::UsLedger,(UInt16)PaperSize::IsoB4,
|
||||||
|
(UInt16)PaperSize::MaxSize,(UInt16)PaperSize::UsStatement
|
||||||
|
#endif //
|
||||||
|
},
|
||||||
index == -1 ? 0 : index,
|
index == -1 ? 0 : index,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
@ -1555,8 +1599,9 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
return success();
|
return success();
|
||||||
case Msg::Reset:
|
case Msg::Reset:
|
||||||
case Msg::GetDefault:
|
case Msg::GetDefault:
|
||||||
m_scanparam->fillbackground = false;
|
m_scanparam->fillbackground = true;
|
||||||
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_IFillBackground), Bool(false));
|
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_IFillBackground), Bool(true));
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
case Msg::Set: {
|
case Msg::Set: {
|
||||||
auto mech = data.currentItem<Bool>();
|
auto mech = data.currentItem<Bool>();
|
||||||
|
@ -1988,6 +2033,30 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_DogEarDelection)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_DogEarDelection)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case Msg::Get:
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<Bool>((CapType)CapTypeEx::TwEx_DogEarDelection, m_scanparam->is_dogeardetection);
|
||||||
|
return success();
|
||||||
|
case Msg::GetDefault:
|
||||||
|
case Msg::Reset:
|
||||||
|
m_scanparam->is_dogeardetection = false;
|
||||||
|
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_DogEarDelection), Bool(false));
|
||||||
|
return success();
|
||||||
|
case Msg::Set:
|
||||||
|
{
|
||||||
|
auto mech = data.currentItem<Bool>();
|
||||||
|
m_scanparam->is_dogeardetection= mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
//双张检测 与官方标准定义有所差异 此协议修改为bool型
|
//双张检测 与官方标准定义有所差异 此协议修改为bool型
|
||||||
m_query[CapType::DoubleFeedDetection] = msgSupportGetAllSetReset;
|
m_query[CapType::DoubleFeedDetection] = msgSupportGetAllSetReset;
|
||||||
m_caps[CapType::DoubleFeedDetection] = [this](Msg msg, Capability& data)->Result {
|
m_caps[CapType::DoubleFeedDetection] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
@ -2027,7 +2096,7 @@ Result HuagaoDs::identityCloseDs(const Identity&) {
|
||||||
guiBridge.reset();
|
guiBridge.reset();
|
||||||
|
|
||||||
scanner.reset();
|
scanner.reset();
|
||||||
|
bmpData.reset();
|
||||||
if (hMutex)
|
if (hMutex)
|
||||||
{
|
{
|
||||||
ReleaseMutex(hMutex);
|
ReleaseMutex(hMutex);
|
||||||
|
@ -2044,9 +2113,12 @@ Result HuagaoDs::pendingXfersGet(const Identity&, PendingXfers& data) {
|
||||||
|
|
||||||
Result HuagaoDs::pendingXfersEnd(const Identity&, PendingXfers& data) {
|
Result HuagaoDs::pendingXfersEnd(const Identity&, PendingXfers& data) {
|
||||||
//!< end xfer if set count 0
|
//!< end xfer if set count 0
|
||||||
if (bmpData.size() > 0)
|
if (bmpData->size() > 0)
|
||||||
bmpData.clear();
|
{
|
||||||
int ret = scanner->aquire_bmpdata(bmpData);
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = scanner->aquire_bmpdata(*bmpData.get());
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
scanner->Set_ErrorCode(0);
|
scanner->Set_ErrorCode(0);
|
||||||
|
@ -2122,16 +2194,18 @@ Result HuagaoDs::userInterfaceEnable(const Identity&, UserInterface& ui) {
|
||||||
// with hidden UI, the usual workflow DsState::Enabled -> notifyXferReady() -> DsState::XferReady is a single step
|
// with hidden UI, the usual workflow DsState::Enabled -> notifyXferReady() -> DsState::XferReady is a single step
|
||||||
setState(DsState::Enabled);
|
setState(DsState::Enabled);
|
||||||
auto ret = startScan();
|
auto ret = startScan();
|
||||||
if (ret == success()) {
|
if (ret.status().condition() == Twpp::CC::NoMedia)
|
||||||
m_pendingXfers = 1;
|
return ret;
|
||||||
|
//if (ret == success()) {
|
||||||
|
//m_pendingXfers = 1;
|
||||||
auto notified = notifyXferReady();
|
auto notified = notifyXferReady();
|
||||||
return success();
|
return success();
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
m_pendingXfers = 0;
|
// m_pendingXfers = 0;
|
||||||
setState(DsState::Open);
|
// setState(DsState::Open);
|
||||||
return ret;
|
// return ret;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
return showTwainUI(ui);
|
return showTwainUI(ui);
|
||||||
|
@ -2225,7 +2299,7 @@ Result HuagaoDs::imageMemXferGet(const Identity& origin, ImageMemXfer& data) {
|
||||||
vector<uchar> cmpdata;
|
vector<uchar> cmpdata;
|
||||||
if (m_compression == Compression::Group4)
|
if (m_compression == Compression::Group4)
|
||||||
{
|
{
|
||||||
mat = cv::imdecode(bmpData, cv::IMREAD_GRAYSCALE);
|
mat = cv::imdecode(*bmpData.get(), cv::IMREAD_GRAYSCALE);
|
||||||
G4Tiff gt(mat,G4Tiff::Mode::MemoryMode,"",120,m_scanparam->resolution_dst);
|
G4Tiff gt(mat,G4Tiff::Mode::MemoryMode,"",120,m_scanparam->resolution_dst);
|
||||||
gt.GetCompressedData(cmpdata);
|
gt.GetCompressedData(cmpdata);
|
||||||
}
|
}
|
||||||
|
@ -2271,6 +2345,7 @@ Result HuagaoDs::imageMemXferGet(const Identity& origin, ImageMemXfer& data) {
|
||||||
if (m_memXferYOff >= static_cast<UInt32>(std::abs(dib->biHeight))) {
|
if (m_memXferYOff >= static_cast<UInt32>(std::abs(dib->biHeight))) {
|
||||||
m_pendingXfers = 0;
|
m_pendingXfers = 0;
|
||||||
m_memXferYOff = 0;
|
m_memXferYOff = 0;
|
||||||
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
return { ReturnCode::XferDone, ConditionCode::Success };
|
return { ReturnCode::XferDone, ConditionCode::Success };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2285,11 +2360,14 @@ Result HuagaoDs::imageNativeXferGet(const Identity& id, ImageNativeXfer& data) {
|
||||||
if (!m_pendingXfers) {
|
if (!m_pendingXfers) {
|
||||||
return seqError();
|
return seqError();
|
||||||
}
|
}
|
||||||
|
if (m_haveError)
|
||||||
|
return { ReturnCode::Cancel, ConditionCode::Success };
|
||||||
if (data)
|
if (data)
|
||||||
data.release();
|
data.release();
|
||||||
// it does not get easier than that if we already have BMP
|
// it does not get easier than that if we already have BMP
|
||||||
data = ImageNativeXfer(bmpSize());
|
data = ImageNativeXfer(bmpSize());
|
||||||
std::copy(bmpBegin(), bmpEnd(), data.data<char>().data());
|
std::copy(bmpBegin(), bmpEnd(), data.data<char>().data());
|
||||||
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
#ifdef LOG_NORMAL
|
#ifdef LOG_NORMAL
|
||||||
|
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
|
@ -2361,8 +2439,9 @@ Twpp::Result HuagaoDs::imageFileXferGet(const Twpp::Identity& origin)
|
||||||
|
|
||||||
FILE* pfile = fopen(filename.c_str(), "wb");
|
FILE* pfile = fopen(filename.c_str(), "wb");
|
||||||
if (pfile) {
|
if (pfile) {
|
||||||
if (bmpData.size() > 0) {
|
if (bmpData->size() > 0) {
|
||||||
fwrite(bmpData.data(), 1, bmpData.size(), pfile);
|
fwrite(bmpData->data(), 1, bmpData->size(), pfile);
|
||||||
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
fclose(pfile);
|
fclose(pfile);
|
||||||
return Result(ReturnCode::XferDone, ConditionCode::Success);
|
return Result(ReturnCode::XferDone, ConditionCode::Success);
|
||||||
}
|
}
|
||||||
|
@ -2380,7 +2459,7 @@ Twpp::Result HuagaoDs::imageFileXferGet(const Twpp::Identity& origin)
|
||||||
decodetype = cv::IMREAD_GRAYSCALE;
|
decodetype = cv::IMREAD_GRAYSCALE;
|
||||||
|
|
||||||
|
|
||||||
cv::Mat ims = cv::imdecode(bmpData, decodetype);
|
cv::Mat ims = cv::imdecode(*bmpData.get(), decodetype);
|
||||||
|
|
||||||
if (m_compression == Compression::Group4&& m_fileXfer.format()==ImageFileFormat::Tiff)
|
if (m_compression == Compression::Group4&& m_fileXfer.format()==ImageFileFormat::Tiff)
|
||||||
{
|
{
|
||||||
|
@ -2396,6 +2475,8 @@ Twpp::Result HuagaoDs::imageFileXferGet(const Twpp::Identity& origin)
|
||||||
compression_params.push_back(m_jpegQuality);
|
compression_params.push_back(m_jpegQuality);
|
||||||
cv::imwrite(filename, ims, compression_params);
|
cv::imwrite(filename, ims, compression_params);
|
||||||
}
|
}
|
||||||
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
|
ims.release();
|
||||||
return Result(ReturnCode::XferDone, ConditionCode::Success);
|
return Result(ReturnCode::XferDone, ConditionCode::Success);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -2480,7 +2561,7 @@ void HuagaoDs::onDeviceEvent(int eventID)
|
||||||
}
|
}
|
||||||
|
|
||||||
const BITMAPINFOHEADER* HuagaoDs::header() const noexcept {
|
const BITMAPINFOHEADER* HuagaoDs::header() const noexcept {
|
||||||
return reinterpret_cast<const BITMAPINFOHEADER*>(bmpData.data() + sizeof(BITMAPFILEHEADER));
|
return reinterpret_cast<const BITMAPINFOHEADER*>(bmpData->data() + sizeof(BITMAPFILEHEADER));
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32 HuagaoDs::bytesPerLine() const noexcept {
|
UInt32 HuagaoDs::bytesPerLine() const noexcept {
|
||||||
|
@ -2489,15 +2570,15 @@ UInt32 HuagaoDs::bytesPerLine() const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32 HuagaoDs::bmpSize() const noexcept {
|
UInt32 HuagaoDs::bmpSize() const noexcept {
|
||||||
return static_cast<UInt32>(bmpData.size()) - sizeof(BITMAPFILEHEADER);
|
return static_cast<UInt32>(bmpData->size()) - sizeof(BITMAPFILEHEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* HuagaoDs::bmpBegin() const noexcept {
|
const char* HuagaoDs::bmpBegin() const noexcept {
|
||||||
return (const char*)bmpData.cbegin()._Ptr + sizeof(BITMAPFILEHEADER);
|
return (const char*)bmpData->cbegin()._Ptr + sizeof(BITMAPFILEHEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* HuagaoDs::bmpEnd() const noexcept {
|
const char* HuagaoDs::bmpEnd() const noexcept {
|
||||||
return (const char*)bmpData.cend()._Ptr;
|
return (const char*)bmpData->cend()._Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HuagaoDs::updataGscanCap()
|
void HuagaoDs::updataGscanCap()
|
||||||
|
@ -2522,7 +2603,11 @@ Twpp::Result HuagaoDs::startScan()
|
||||||
//FileTools::write_log("D:\\1.txt", "RESET TWAIN TRANSFERED IMAGE COUNT");
|
//FileTools::write_log("D:\\1.txt", "RESET TWAIN TRANSFERED IMAGE COUNT");
|
||||||
if (!scanner->IsConnected())
|
if (!scanner->IsConnected())
|
||||||
{
|
{
|
||||||
|
#ifdef LANXUM
|
||||||
|
scanner->open(0x31c9, 0x8200);
|
||||||
|
#else
|
||||||
scanner->open(0x064B, 0x7823);
|
scanner->open(0x064B, 0x7823);
|
||||||
|
#endif
|
||||||
if (!scanner->IsConnected())
|
if (!scanner->IsConnected())
|
||||||
return checkDeviceOnline();
|
return checkDeviceOnline();
|
||||||
}
|
}
|
||||||
|
@ -2552,14 +2637,15 @@ Twpp::Result HuagaoDs::startScan()
|
||||||
guiIndicator->ShowWindow(SW_SHOWNORMAL);
|
guiIndicator->ShowWindow(SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
scanner->Scanner_StartScan(m_scanparam->scannum);
|
scanner->Scanner_StartScan(m_scanparam->scannum);
|
||||||
if (bmpData.size() > 0)
|
if (bmpData->size() > 0)
|
||||||
bmpData.clear();
|
{
|
||||||
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
|
}
|
||||||
if (guiTwain.get()) {
|
if (guiTwain.get()) {
|
||||||
((CTwainUI*)(guiTwain.get()))->EnableID_OKorID_Cancel(false);
|
((CTwainUI*)(guiTwain.get()))->EnableID_OKorID_Cancel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int retCode = scanner->aquire_bmpdata(bmpData);
|
int retCode = scanner->aquire_bmpdata(*bmpData.get());
|
||||||
if (retCode != 0) {
|
if (retCode != 0) {
|
||||||
scanner->Set_ErrorCode(0);
|
scanner->Set_ErrorCode(0);
|
||||||
if (guiIndicator)
|
if (guiIndicator)
|
||||||
|
@ -2571,6 +2657,9 @@ Twpp::Result HuagaoDs::startScan()
|
||||||
//MessageBox(guiTwain ? guiTwain->m_hWnd : NULL, noticeMsgMap[retCode], _T("提示"), MB_SYSTEMMODAL | MB_OK | MB_ICONINFORMATION);
|
//MessageBox(guiTwain ? guiTwain->m_hWnd : NULL, noticeMsgMap[retCode], _T("提示"), MB_SYSTEMMODAL | MB_OK | MB_ICONINFORMATION);
|
||||||
CString str;
|
CString str;
|
||||||
str.Format(_T("%d"), retCode);
|
str.Format(_T("%d"), retCode);
|
||||||
|
m_pendingXfers = 0;
|
||||||
|
m_memXferYOff = 0;
|
||||||
|
m_haveError = true;
|
||||||
ShellExecute(guiTwain ? guiTwain->m_hWnd : NULL, TEXT("open"), GetHidedlgPath(), str, NULL, SW_HIDE);
|
ShellExecute(guiTwain ? guiTwain->m_hWnd : NULL, TEXT("open"), GetHidedlgPath(), str, NULL, SW_HIDE);
|
||||||
#ifndef G200
|
#ifndef G200
|
||||||
scanner->clear_hwerror();
|
scanner->clear_hwerror();
|
||||||
|
@ -2586,7 +2675,8 @@ Twpp::Result HuagaoDs::startScan()
|
||||||
return seqError();
|
return seqError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmpData.size() > 0) {
|
if (bmpData->size() > 0) {
|
||||||
|
m_haveError = false;
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -90,6 +90,7 @@ private://method
|
||||||
Twpp::UInt32 bmpSize() const noexcept;
|
Twpp::UInt32 bmpSize() const noexcept;
|
||||||
const char* bmpBegin() const noexcept;
|
const char* bmpBegin() const noexcept;
|
||||||
const char* bmpEnd() const noexcept;
|
const char* bmpEnd() const noexcept;
|
||||||
|
void dogear_callback(int indexpaper);
|
||||||
void updataGscanCap();
|
void updataGscanCap();
|
||||||
Twpp::Result capCommon(const Twpp::Identity& origin, Twpp::Msg msg, Twpp::Capability& data);
|
Twpp::Result capCommon(const Twpp::Identity& origin, Twpp::Msg msg, Twpp::Capability& data);
|
||||||
|
|
||||||
|
@ -112,10 +113,11 @@ private://field
|
||||||
bool m_bCustomDsData = true;
|
bool m_bCustomDsData = true;
|
||||||
bool m_bFeederEnabled = true;
|
bool m_bFeederEnabled = true;
|
||||||
bool m_bAutoFeed = true;
|
bool m_bAutoFeed = true;
|
||||||
|
bool m_haveError = false;
|
||||||
UINT16 m_iBitdepth;
|
UINT16 m_iBitdepth;
|
||||||
Twpp::ImageFileFormat m_capImageFileFormat = Twpp::ImageFileFormat::Bmp;
|
Twpp::ImageFileFormat m_capImageFileFormat = Twpp::ImageFileFormat::Bmp;
|
||||||
std::queue<Twpp::DeviceEvent> devEvent;
|
std::queue<Twpp::DeviceEvent> devEvent;
|
||||||
std::vector<unsigned char> bmpData;
|
std::unique_ptr < std::vector<unsigned char>> bmpData;
|
||||||
std::unique_ptr<GScanCap> m_scanparam;
|
std::unique_ptr<GScanCap> m_scanparam;
|
||||||
HANDLE hMutex;
|
HANDLE hMutex;
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
Binary file not shown.
BIN
huagao/stdafx.h
BIN
huagao/stdafx.h
Binary file not shown.
Loading…
Reference in New Issue