mirror of http://192.168.1.51:8099/lmh188/twain3.0
1)开放高级参数设置 -边缘缩进、降噪像素、二值化阈值、黑框填充模式
2)修改旋转算法 90°与-90°时第一张图与第二张图旋转方向相反 3)添加黑白降噪优化 4)暂时屏蔽界面600dpi 5)程序内部修改对比度等级 6)修改帮助文档路径名 现改为pdf
This commit is contained in:
parent
90f0c0935c
commit
1bc01856f1
|
@ -0,0 +1,96 @@
|
||||||
|
// CAdvancedDLG.cpp: 实现文件
|
||||||
|
//
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "CAdvancedDLG.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
|
||||||
|
// CAdvancedDLG 对话框
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(CAdvancedDLG, CTabPageSSL)
|
||||||
|
|
||||||
|
CAdvancedDLG::CAdvancedDLG(int d, int n, int t, bool c, bool showconvex, CWnd* pParent /*=nullptr*/)
|
||||||
|
: CTabPageSSL(IDD_ADVANCED, pParent)
|
||||||
|
,indent(d)
|
||||||
|
,noise(n)
|
||||||
|
,threshold(t)
|
||||||
|
,is_convex(c)
|
||||||
|
,showis_convex(showconvex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CAdvancedDLG::~CAdvancedDLG()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAdvancedDLG::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CTabPageSSL::DoDataExchange(pDX);
|
||||||
|
DDX_Control(pDX, IDC_EDIT_NOISE, m_Edit_noise);
|
||||||
|
DDX_Control(pDX, IDC_EDIT_INDENT, m_Edit_indent);
|
||||||
|
DDX_Control(pDX, IDC_EDIT_THRESHOLD, m_Edit_threshold);
|
||||||
|
DDX_Control(pDX, IDC_SLIDER_INDENT, m_Slider_indent);
|
||||||
|
DDX_Control(pDX, IDC_SLIDER_NOISE, m_Slider_noise);
|
||||||
|
DDX_Control(pDX, IDC_SLIDER_THRESHOLD, m_Slider_threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CAdvancedDLG::OnInitDialog()
|
||||||
|
{
|
||||||
|
this->SetWindowTextW(L"高级设置");
|
||||||
|
|
||||||
|
CTabPageSSL::OnInitDialog();
|
||||||
|
m_Edit_noise.SetSlideLink(this, IDC_SLIDER_NOISE);
|
||||||
|
m_Edit_noise.SetParams(30, 50, 2);
|
||||||
|
m_Edit_noise.SetValue(noise);
|
||||||
|
|
||||||
|
m_Edit_indent.SetSlideLink(this, IDC_SLIDER_INDENT);
|
||||||
|
m_Edit_indent.SetParams(5, 30, 2);
|
||||||
|
m_Edit_indent.SetValue(indent);
|
||||||
|
|
||||||
|
m_Edit_threshold.SetSlideLink(this, IDC_SLIDER_THRESHOLD);
|
||||||
|
m_Edit_threshold.SetParams(30, 50, 2);
|
||||||
|
m_Edit_threshold.SetValue(threshold);
|
||||||
|
if (showis_convex)
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXA))->SetCheck(is_convex);
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXB))->SetCheck(!is_convex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXA))->SetCheck(is_convex);
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXB))->SetCheck(!is_convex);
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXA))->EnableWindow(FALSE);
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXB))->EnableWindow(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CAdvancedDLG, CTabPageSSL)
|
||||||
|
ON_BN_CLICKED(IDC_CONVEXA, &CAdvancedDLG::OnBnClickedConvexa)
|
||||||
|
ON_BN_CLICKED(IDC_CONVEXB, &CAdvancedDLG::OnBnClickedConvexb)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CAdvancedDLG 消息处理程序
|
||||||
|
|
||||||
|
|
||||||
|
void CAdvancedDLG::OnBnClickedConvexa()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXA))->SetCheck(true);
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXB))->SetCheck(false);
|
||||||
|
is_convex = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CAdvancedDLG::OnBnClickedConvexb()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXA))->SetCheck(false);
|
||||||
|
((CButton*)GetDlgItem(IDC_CONVEXB))->SetCheck(true);
|
||||||
|
is_convex = false;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
#pragma once
|
||||||
|
#include "TabPageSSL.h"
|
||||||
|
#include "Sliders.h"
|
||||||
|
#include "SmartEdit.h"
|
||||||
|
|
||||||
|
// CAdvancedDLG 对话框
|
||||||
|
|
||||||
|
class CAdvancedDLG : public CTabPageSSL
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC(CAdvancedDLG)
|
||||||
|
|
||||||
|
public:
|
||||||
|
CAdvancedDLG(int d,int n,int t,bool c,bool showconvex,CWnd* pParent = nullptr); // 标准构造函数
|
||||||
|
virtual ~CAdvancedDLG();
|
||||||
|
CSmartEdit m_Edit_indent;
|
||||||
|
CSmartEdit m_Edit_noise;
|
||||||
|
CSmartEdit m_Edit_threshold;
|
||||||
|
CLinkSlider m_Slider_noise;
|
||||||
|
CLinkSlider m_Slider_indent;
|
||||||
|
CLinkSlider m_Slider_threshold;
|
||||||
|
|
||||||
|
int indent;
|
||||||
|
int noise;
|
||||||
|
int threshold;
|
||||||
|
bool is_convex;
|
||||||
|
bool showis_convex;
|
||||||
|
// 对话框数据
|
||||||
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
enum { IDD = IDD_ADVANCED };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
public:
|
||||||
|
afx_msg void OnBnClickedConvexa();
|
||||||
|
afx_msg void OnBnClickedConvexb();
|
||||||
|
};
|
|
@ -85,7 +85,9 @@ static std::vector<CString> reslutions{
|
||||||
_T("200"),
|
_T("200"),
|
||||||
_T("240"),
|
_T("240"),
|
||||||
_T("300"),
|
_T("300"),
|
||||||
_T("600")
|
#ifndef LANXUM
|
||||||
|
//_T("600")
|
||||||
|
#endif // LANXUM
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<CString> duplexs
|
static std::vector<CString> duplexs
|
||||||
|
@ -108,6 +110,7 @@ CBasicPage::CBasicPage(std::function<void()> dataChange, CWnd* pParent /*=nullpt
|
||||||
, AreaNum(8)
|
, AreaNum(8)
|
||||||
, DevnMax(200)
|
, DevnMax(200)
|
||||||
, m_bswitchfrontback(FALSE)
|
, m_bswitchfrontback(FALSE)
|
||||||
|
,discardblank_percent(10)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -212,9 +215,9 @@ void CBasicPage::OnCbnSelchangeCmbduplex()
|
||||||
m_dataChange();
|
m_dataChange();
|
||||||
//}
|
//}
|
||||||
if (m_cmBoxDuplex->GetCurSel() == 2 || m_cmBoxDuplex->GetCurSel() == 3)
|
if (m_cmBoxDuplex->GetCurSel() == 2 || m_cmBoxDuplex->GetCurSel() == 3)
|
||||||
this->GetDlgItem(IDC_BTNDISCARDSETTING)->ShowWindow(SW_SHOW);
|
this->GetDlgItem(IDC_BTNDISCARDSETTING)->EnableWindow(true);
|
||||||
else
|
else
|
||||||
this->GetDlgItem(IDC_BTNDISCARDSETTING)->ShowWindow(SW_HIDE);
|
this->GetDlgItem(IDC_BTNDISCARDSETTING)->EnableWindow(false);
|
||||||
updateCmbDuplex(TRUE);
|
updateCmbDuplex(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +232,7 @@ void CBasicPage::OnClickedBtndiscardsetting()
|
||||||
//if (nRet == IDOK) {
|
//if (nRet == IDOK) {
|
||||||
// dbs.GetParams(AreaNum, DevnMax);
|
// dbs.GetParams(AreaNum, DevnMax);
|
||||||
//}
|
//}
|
||||||
CcardblankDlg settingdlg(discardblank_percent);
|
CcardblankDlg settingdlg(discardblank_percent,this);
|
||||||
settingdlg.DoModal();
|
settingdlg.DoModal();
|
||||||
discardblank_percent = settingdlg.discardblank_percent;
|
discardblank_percent = settingdlg.discardblank_percent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ CBrightnessPage::CBrightnessPage(CWnd* pParent /*=nullptr*/)
|
||||||
: CTabPageSSL(IDD_PAGEBRIGHTNESS, pParent)
|
: CTabPageSSL(IDD_PAGEBRIGHTNESS, pParent)
|
||||||
, m_cbAutoContrast(FALSE)
|
, m_cbAutoContrast(FALSE)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CBrightnessPage::~CBrightnessPage()
|
CBrightnessPage::~CBrightnessPage()
|
||||||
|
|
|
@ -115,7 +115,7 @@ void CFeedPaperPage::FeedPaperPageUpdate(int val)
|
||||||
//if (val == 0 || val == 4)//单面或对折
|
//if (val == 0 || val == 4)//单面或对折
|
||||||
// m_tempBtn->SetCheck(0);
|
// m_tempBtn->SetCheck(0);
|
||||||
//BOOL enable = (val == 0 || val == 4);
|
//BOOL enable = (val == 0 || val == 4);
|
||||||
//m_tempBtn->EnableWindow(!enable);
|
//m_tempBtn->EnableWindow(!enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFeedPaperPage::FeedAutoDescrewUpdate(int val)
|
void CFeedPaperPage::FeedAutoDescrewUpdate(int val)
|
||||||
|
|
|
@ -36,7 +36,12 @@ CImageProcPage::CImageProcPage(CWnd* pParent /*=nullptr*/)
|
||||||
, m_ckbAutoDeskrew(FALSE)
|
, m_ckbAutoDeskrew(FALSE)
|
||||||
, m_ckbMultioutput(FALSE)
|
, m_ckbMultioutput(FALSE)
|
||||||
, m_ckbRemoveHole(FALSE)
|
, m_ckbRemoveHole(FALSE)
|
||||||
|
, m_ckbDetachNoise(FALSE)
|
||||||
, m_ckbHSVCorrect(FALSE)
|
, m_ckbHSVCorrect(FALSE)
|
||||||
|
, indent(5)
|
||||||
|
, noise(40)
|
||||||
|
,threshold(40)
|
||||||
|
,is_bw(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,15 +50,20 @@ CImageProcPage::~CImageProcPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CImageProcPage::ImageProcPageUpdate(int val)
|
void CImageProcPage::ImageProcPageUpdate(int val,bool is_Crop)
|
||||||
{
|
{
|
||||||
CComboBox* m_temp = (CComboBox*)(GetDlgItem(IDC_CMBFILTER));
|
CComboBox* m_temp = (CComboBox*)(GetDlgItem(IDC_CMBFILTER));
|
||||||
CButton* t_chMultiOutput = (CButton*)(GetDlgItem(IDC_CKMULTIOUTPUT));
|
CButton* t_chMultiOutput = (CButton*)(GetDlgItem(IDC_CKMULTIOUTPUT));
|
||||||
CComboBox* m_temp_sharpen = (CComboBox*)(GetDlgItem(IDC_CMBSHARPEN));
|
CComboBox* m_temp_sharpen = (CComboBox*)(GetDlgItem(IDC_CMBSHARPEN));
|
||||||
|
is_bw = val == 2 ? true : false;
|
||||||
int ival = (val == 0 ? 0 : (val == 1 ? 1 : 2));
|
int ival = (val == 0 ? 0 : (val == 1 ? 1 : 2));
|
||||||
|
this->is_crop = is_Crop;
|
||||||
|
if (((CButton*)GetDlgItem(IDC_CKFILLBLACKRECT))->GetCheck() || ((CButton*)GetDlgItem(IDC_CKAUTODESKREW))->GetCheck() || is_crop)
|
||||||
|
((CButton*)GetDlgItem(IDC_ADVANCEDSET))->EnableWindow(true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_ADVANCEDSET))->EnableWindow(false);
|
||||||
|
}
|
||||||
if (0 == ival)//彩色
|
if (0 == ival)//彩色
|
||||||
{
|
{
|
||||||
m_temp->SetCurSel(0);
|
m_temp->SetCurSel(0);
|
||||||
|
@ -68,7 +78,17 @@ void CImageProcPage::ImageProcPageUpdate(int val)
|
||||||
t_chMultiOutput->SetCheck(FALSE);
|
t_chMultiOutput->SetCheck(FALSE);
|
||||||
t_chMultiOutput->EnableWindow(FALSE);
|
t_chMultiOutput->EnableWindow(FALSE);
|
||||||
}
|
}
|
||||||
|
if (ival == 2)
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->EnableWindow(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(false);
|
||||||
|
((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->EnableWindow(false);
|
||||||
|
m_edit_detachnoise.EnableWindow(false);
|
||||||
|
m_slider_detachnoise.EnableWindow(false);
|
||||||
|
}
|
||||||
//bool enabele = ival <= 1;//彩色或灰度
|
//bool enabele = ival <= 1;//彩色或灰度
|
||||||
//if (!enabele) {
|
//if (!enabele) {
|
||||||
// m_temp_sharpen->SetCurSel(0);
|
// m_temp_sharpen->SetCurSel(0);
|
||||||
|
@ -91,12 +111,15 @@ void CImageProcPage::DoDataExchange(CDataExchange* pDX)
|
||||||
CTabPageSSL::DoDataExchange(pDX);
|
CTabPageSSL::DoDataExchange(pDX);
|
||||||
DDX_Control(pDX, IDC_SLDOUTHOLE, m_slider_hole);
|
DDX_Control(pDX, IDC_SLDOUTHOLE, m_slider_hole);
|
||||||
DDX_Control(pDX, IDC_EDIT_HOLE, m_edit_hole);
|
DDX_Control(pDX, IDC_EDIT_HOLE, m_edit_hole);
|
||||||
|
DDX_Control(pDX, IDC_EDITDETACHNOISE, m_edit_detachnoise);
|
||||||
|
DDX_Control(pDX, IDC_SLIDERDETACHNOISE, m_slider_detachnoise);
|
||||||
DDX_Control(pDX, IDC_CMBFILTER, m_cmBoxFilter);
|
DDX_Control(pDX, IDC_CMBFILTER, m_cmBoxFilter);
|
||||||
DDX_Control(pDX, IDC_CMBSHARPEN, m_cmBoxSharpen);
|
DDX_Control(pDX, IDC_CMBSHARPEN, m_cmBoxSharpen);
|
||||||
DDX_Check(pDX, IDC_CKFILLBLACKRECT, m_ckbFillBlack);
|
DDX_Check(pDX, IDC_CKFILLBLACKRECT, m_ckbFillBlack);
|
||||||
DDX_Check(pDX, IDC_CKAUTODESKREW, m_ckbAutoDeskrew);
|
DDX_Check(pDX, IDC_CKAUTODESKREW, m_ckbAutoDeskrew);
|
||||||
DDX_Check(pDX, IDC_CKMULTIOUTPUT, m_ckbMultioutput);
|
DDX_Check(pDX, IDC_CKMULTIOUTPUT, m_ckbMultioutput);
|
||||||
DDX_Check(pDX, IDC_CKREMOVEHOLE, m_ckbRemoveHole);
|
DDX_Check(pDX, IDC_CKREMOVEHOLE, m_ckbRemoveHole);
|
||||||
|
DDX_Check(pDX, IDC_CHECKDETACHNOISE,m_ckbDetachNoise);
|
||||||
DDX_Check(pDX, IDC_CKHSVCORRECT, m_ckbHSVCorrect);
|
DDX_Check(pDX, IDC_CKHSVCORRECT, m_ckbHSVCorrect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +130,11 @@ BOOL CImageProcPage::OnInitDialog()
|
||||||
m_edit_hole.SetParams(0.01, 0.50, 10, _T("%0.2f"));
|
m_edit_hole.SetParams(0.01, 0.50, 10, _T("%0.2f"));
|
||||||
m_edit_hole.SetValue(0.10);
|
m_edit_hole.SetValue(0.10);
|
||||||
|
|
||||||
|
m_edit_detachnoise.SetSlideLink(this, IDC_SLIDERDETACHNOISE);
|
||||||
|
m_edit_detachnoise.SetParams(10, 50, 10);
|
||||||
|
m_edit_detachnoise.SetValue(detachnoise);
|
||||||
|
|
||||||
|
((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(is_detachnoise);
|
||||||
for (int i = 0; i < filters.size(); i++)
|
for (int i = 0; i < filters.size(); i++)
|
||||||
{
|
{
|
||||||
m_cmBoxFilter.InsertString(i, filters[i]);
|
m_cmBoxFilter.InsertString(i, filters[i]);
|
||||||
|
@ -123,6 +151,10 @@ BOOL CImageProcPage::OnInitDialog()
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CImageProcPage, CTabPageSSL)
|
BEGIN_MESSAGE_MAP(CImageProcPage, CTabPageSSL)
|
||||||
ON_BN_CLICKED(IDC_CKREMOVEHOLE, &CImageProcPage::OnCtrlChange)
|
ON_BN_CLICKED(IDC_CKREMOVEHOLE, &CImageProcPage::OnCtrlChange)
|
||||||
|
ON_BN_CLICKED(IDC_ADVANCEDSET, &CImageProcPage::OnBnClickedAdvancedset)
|
||||||
|
ON_BN_CLICKED(IDC_CKFILLBLACKRECT, &CImageProcPage::OnBnClickedCkfillblackrect)
|
||||||
|
ON_BN_CLICKED(IDC_CKAUTODESKREW, &CImageProcPage::OnBnClickedCkautodeskrew)
|
||||||
|
ON_BN_CLICKED(IDC_CHECKDETACHNOISE, &CImageProcPage::OnBnClickedCheckdetachnoise)
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
void CImageProcPage::EnableOutHoleCheckChanged(BOOL enable)
|
void CImageProcPage::EnableOutHoleCheckChanged(BOOL enable)
|
||||||
|
@ -164,4 +196,53 @@ void CImageProcPage::OnCtrlChange()
|
||||||
UpdateData();
|
UpdateData();
|
||||||
m_edit_hole.EnableWindow(m_ckbRemoveHole);
|
m_edit_hole.EnableWindow(m_ckbRemoveHole);
|
||||||
m_slider_hole.EnableWindow(m_ckbRemoveHole);
|
m_slider_hole.EnableWindow(m_ckbRemoveHole);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CImageProcPage::OnBnClickedAdvancedset()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
CAdvancedDLG cb(indent, noise, threshold,is_convex,((CButton*)GetDlgItem(IDC_CKFILLBLACKRECT))->GetCheck(),this);
|
||||||
|
cb.DoModal();
|
||||||
|
noise= cb.m_Slider_noise.m_iPosition;
|
||||||
|
indent = cb.m_Slider_indent.m_iPosition;
|
||||||
|
threshold = cb.m_Slider_threshold.m_iPosition;
|
||||||
|
is_convex = cb.is_convex;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CImageProcPage::OnBnClickedCkfillblackrect()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
if(((CButton*)GetDlgItem(IDC_CKFILLBLACKRECT))->GetCheck()|| ((CButton*)GetDlgItem(IDC_CKAUTODESKREW))->GetCheck()||is_crop)
|
||||||
|
((CButton*)GetDlgItem(IDC_ADVANCEDSET))->EnableWindow(true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_ADVANCEDSET))->EnableWindow(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CImageProcPage::OnBnClickedCkautodeskrew()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
if (((CButton*)GetDlgItem(IDC_CKFILLBLACKRECT))->GetCheck() || ((CButton*)GetDlgItem(IDC_CKAUTODESKREW))->GetCheck() || is_crop)
|
||||||
|
((CButton*)GetDlgItem(IDC_ADVANCEDSET))->EnableWindow(true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((CButton*)GetDlgItem(IDC_ADVANCEDSET))->EnableWindow(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CImageProcPage::OnBnClickedCheckdetachnoise()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
UpdateData();
|
||||||
|
m_ckbDetachNoise = m_ckbDetachNoise && is_bw;
|
||||||
|
m_edit_detachnoise.EnableWindow(m_ckbDetachNoise);
|
||||||
|
m_slider_detachnoise.EnableWindow(m_ckbDetachNoise);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
#include "TabPageSSL.h"
|
#include "TabPageSSL.h"
|
||||||
#include "Sliders.h"
|
#include "Sliders.h"
|
||||||
#include "SmartEdit.h"
|
#include "SmartEdit.h"
|
||||||
|
#include "CAdvancedDLG.h"
|
||||||
|
|
||||||
// CImageProcPage 对话框
|
// CImageProcPage 对话框
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ public:
|
||||||
|
|
||||||
CLinkSlider m_slider_hole;
|
CLinkSlider m_slider_hole;
|
||||||
CSmartEdit m_edit_hole;
|
CSmartEdit m_edit_hole;
|
||||||
|
CLinkSlider m_slider_detachnoise;
|
||||||
|
CSmartEdit m_edit_detachnoise;
|
||||||
CComboBox m_cmBoxFilter;
|
CComboBox m_cmBoxFilter;
|
||||||
CComboBox m_cmBoxSharpen;
|
CComboBox m_cmBoxSharpen;
|
||||||
BOOL m_ckbFillBlack;
|
BOOL m_ckbFillBlack;
|
||||||
|
@ -22,12 +26,20 @@ public:
|
||||||
BOOL m_ckbMultioutput;
|
BOOL m_ckbMultioutput;
|
||||||
BOOL m_ckbRemoveHole;
|
BOOL m_ckbRemoveHole;
|
||||||
BOOL m_ckbHSVCorrect;
|
BOOL m_ckbHSVCorrect;
|
||||||
|
BOOL m_ckbDetachNoise;
|
||||||
void ImageProcPageUpdate(int val);
|
void ImageProcPageUpdate(int val, bool is_Crop);
|
||||||
void ImageAutoDescrewUpdate(int val);
|
void ImageAutoDescrewUpdate(int val);
|
||||||
void EnableOutHoleCheckChanged(BOOL enable);
|
void EnableOutHoleCheckChanged(BOOL enable);
|
||||||
void SetOutHoleValue(int value);
|
void SetOutHoleValue(int value);
|
||||||
void SetMultiOutputEnable(int pixtype, bool enable);
|
void SetMultiOutputEnable(int pixtype, bool enable);
|
||||||
|
int detachnoise;
|
||||||
|
int indent;
|
||||||
|
int noise;
|
||||||
|
int threshold;
|
||||||
|
bool is_convex;
|
||||||
|
bool is_crop;
|
||||||
|
bool is_bw;
|
||||||
|
bool is_detachnoise;
|
||||||
// 对话框数据
|
// 对话框数据
|
||||||
#ifdef AFX_DESIGN_TIME
|
#ifdef AFX_DESIGN_TIME
|
||||||
enum { IDD = IDD_PAGEIMGPROC };
|
enum { IDD = IDD_PAGEIMGPROC };
|
||||||
|
@ -42,4 +54,9 @@ protected:
|
||||||
afx_msg void OnCtrlChange();
|
afx_msg void OnCtrlChange();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
afx_msg void OnBnClickedAdvancedset();
|
||||||
|
afx_msg void OnBnClickedCkfillblackrect();
|
||||||
|
afx_msg void OnBnClickedCkautodeskrew();
|
||||||
|
afx_msg void OnBnClickedCheckdetachnoise();
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
|
@ -30,6 +30,13 @@ CTwainUI::CTwainUI(TwGlue glue, GScanCap caps, std::string confirmtitle, std::st
|
||||||
m_hardwareVersion = hardwareversion;
|
m_hardwareVersion = hardwareversion;
|
||||||
m_serialnum = serialnum;
|
m_serialnum = serialnum;
|
||||||
//memset(settings.get(), 0, sizeof(GScanCap));
|
//memset(settings.get(), 0, sizeof(GScanCap));
|
||||||
|
m_pageImageProc->noise = caps.noise;
|
||||||
|
m_pageImageProc->is_convex = caps.is_convex;
|
||||||
|
m_pageImageProc->threshold = caps.AutoCrop_threshold;
|
||||||
|
m_pageImageProc->indent = caps.indent;
|
||||||
|
m_pageImageProc->detachnoise = caps.detachnoise.detachnoise;
|
||||||
|
m_pageImageProc->is_detachnoise = caps.detachnoise.is_detachnoise;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CTwainUI::~CTwainUI()
|
CTwainUI::~CTwainUI()
|
||||||
|
@ -53,7 +60,8 @@ BOOL CTwainUI::OnInitDialog()
|
||||||
this->SetWindowText(TWAIN_NAME);
|
this->SetWindowText(TWAIN_NAME);
|
||||||
|
|
||||||
auto dataChangeFunction = [this]() {
|
auto dataChangeFunction = [this]() {
|
||||||
m_pageImageProc->ImageProcPageUpdate(m_pageBasic->m_cmBoxColorMode->GetCurSel());
|
m_pageImageProc->ImageProcPageUpdate(m_pageBasic->m_cmBoxColorMode->GetCurSel(),
|
||||||
|
(getcombox_ss(m_pageBasic->m_cmBoxSS->GetCurSel())== TwSS::USStatement)||(getcombox_ss(m_pageBasic->m_cmBoxSS->GetCurSel()) == TwSS::None));
|
||||||
m_pageFeedPaper->FeedPaperPageUpdate(m_pageBasic->m_cmBoxDuplex->GetCurSel());
|
m_pageFeedPaper->FeedPaperPageUpdate(m_pageBasic->m_cmBoxDuplex->GetCurSel());
|
||||||
m_pageImageProc->ImageAutoDescrewUpdate(m_pageBasic->m_cmBoxSS->GetCurSel());
|
m_pageImageProc->ImageAutoDescrewUpdate(m_pageBasic->m_cmBoxSS->GetCurSel());
|
||||||
//m_pageFeedPaper->FeedAutoDescrewUpdate(m_pageBasic->m_cmBoxSS->GetCurSel());
|
//m_pageFeedPaper->FeedAutoDescrewUpdate(m_pageBasic->m_cmBoxSS->GetCurSel());
|
||||||
|
@ -63,6 +71,7 @@ BOOL CTwainUI::OnInitDialog()
|
||||||
int nPageID = 0;
|
int nPageID = 0;
|
||||||
m_pageBasic.reset(new CBasicPage(dataChangeFunction));
|
m_pageBasic.reset(new CBasicPage(dataChangeFunction));
|
||||||
m_pageBasic->Create(IDD_PAGEBASIC, this);
|
m_pageBasic->Create(IDD_PAGEBASIC, this);
|
||||||
|
m_pageBasic->discardblank_percent = settings->discardblank_percent;
|
||||||
m_pageBasic->SetScannerInfo(m_hardwareVersion, m_serialnum);
|
m_pageBasic->SetScannerInfo(m_hardwareVersion, m_serialnum);
|
||||||
m_tabCtrl->AddSSLPage(_T("基本"), nPageID++, m_pageBasic.get());
|
m_tabCtrl->AddSSLPage(_T("基本"), nPageID++, m_pageBasic.get());
|
||||||
m_pageBrightness->Create(IDD_PAGEBRIGHTNESS, this);
|
m_pageBrightness->Create(IDD_PAGEBRIGHTNESS, this);
|
||||||
|
@ -76,7 +85,7 @@ BOOL CTwainUI::OnInitDialog()
|
||||||
|
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
UpdateListConfig();
|
UpdateListConfig();
|
||||||
UpdateUi();
|
dataChangeFunction();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +119,11 @@ void CTwainUI::OnBnClickedBtndefault()
|
||||||
GscanJsonConfig js;
|
GscanJsonConfig js;
|
||||||
GScanCap cf = js.GetDefaultGscancapValue();
|
GScanCap cf = js.GetDefaultGscancapValue();
|
||||||
settings.reset(new GScanCap(cf));
|
settings.reset(new GScanCap(cf));
|
||||||
|
m_pageImageProc->noise = 40;
|
||||||
|
m_pageImageProc->threshold = 40;
|
||||||
|
m_pageImageProc->indent = 5;
|
||||||
|
m_pageImageProc->is_convex = true;
|
||||||
|
m_pageBasic->discardblank_percent = 20;
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +159,10 @@ void CTwainUI::UpdateUI()
|
||||||
m_pageBasic->m_cmBoxSS->SetCurSel(getPaparSizeIndex(settings->papertype, settings->paperAlign)); //!< 纸张类型
|
m_pageBasic->m_cmBoxSS->SetCurSel(getPaparSizeIndex(settings->papertype, settings->paperAlign)); //!< 纸张类型
|
||||||
m_pageBasic->m_bswitchfrontback = settings->is_switchfrontback ? TRUE : FALSE; //!< 交换正反面
|
m_pageBasic->m_bswitchfrontback = settings->is_switchfrontback ? TRUE : FALSE; //!< 交换正反面
|
||||||
m_pageBasic->UpdateData(FALSE);
|
m_pageBasic->UpdateData(FALSE);
|
||||||
|
if(getCmbDuplexIndex()==2|| getCmbDuplexIndex()==3)
|
||||||
|
m_pageBasic->GetDlgItem(IDC_BTNDISCARDSETTING)->EnableWindow(true);
|
||||||
|
else
|
||||||
|
m_pageBasic->GetDlgItem(IDC_BTNDISCARDSETTING)->EnableWindow(false);
|
||||||
//!< Page Breghtness
|
//!< Page Breghtness
|
||||||
m_pageBrightness->m_cbAutoContrast = settings->is_autocontrast==TRUE?TRUE:FALSE; //!< 自动亮度对比度
|
m_pageBrightness->m_cbAutoContrast = settings->is_autocontrast==TRUE?TRUE:FALSE; //!< 自动亮度对比度
|
||||||
int brt = GetMappingBrightnessValue(settings->brightness);
|
int brt = GetMappingBrightnessValue(settings->brightness);
|
||||||
|
@ -156,6 +173,7 @@ void CTwainUI::UpdateUI()
|
||||||
m_pageBrightness->UpdateData(FALSE);
|
m_pageBrightness->UpdateData(FALSE);
|
||||||
|
|
||||||
//!< Page Proc
|
//!< Page Proc
|
||||||
|
//!
|
||||||
m_pageImageProc->m_ckbFillBlack = settings->fillbackground==TRUE ? TRUE : FALSE;//填充黑框
|
m_pageImageProc->m_ckbFillBlack = settings->fillbackground==TRUE ? TRUE : FALSE;//填充黑框
|
||||||
m_pageImageProc->m_ckbAutoDeskrew = settings->autodescrew ? TRUE : FALSE;//自动纠偏
|
m_pageImageProc->m_ckbAutoDeskrew = settings->autodescrew ? TRUE : FALSE;//自动纠偏
|
||||||
UpdateFilterCmbx();
|
UpdateFilterCmbx();
|
||||||
|
@ -164,6 +182,10 @@ void CTwainUI::UpdateUI()
|
||||||
m_pageImageProc->m_ckbRemoveHole = settings->fillhole.is_fillhole==TRUE?TRUE:FALSE;//除穿孔可用性
|
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.SetValue(settings->fillhole.fillholeratio/ 100.0);//穿孔搜索范围比例系数
|
||||||
m_pageImageProc->m_edit_hole.EnableWindow(settings->fillhole.is_fillhole == TRUE ? TRUE : FALSE);
|
m_pageImageProc->m_edit_hole.EnableWindow(settings->fillhole.is_fillhole == TRUE ? TRUE : FALSE);
|
||||||
|
m_pageImageProc->m_ckbDetachNoise = settings->detachnoise.is_detachnoise == TRUE ? TRUE : FALSE;//黑白降噪是否启用
|
||||||
|
((CButton*)m_pageImageProc->GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(m_pageImageProc->m_ckbDetachNoise);
|
||||||
|
m_pageImageProc->m_edit_detachnoise.SetValue(settings->detachnoise.detachnoise);
|
||||||
|
m_pageImageProc->m_slider_detachnoise.EnableWindow(settings->detachnoise.is_detachnoise == TRUE ? TRUE : FALSE);
|
||||||
if (settings->pixtype == 2)
|
if (settings->pixtype == 2)
|
||||||
m_pageImageProc->m_ckbMultioutput = settings->multi_output_red == TRUE ? TRUE : FALSE;//多流除红
|
m_pageImageProc->m_ckbMultioutput = settings->multi_output_red == TRUE ? TRUE : FALSE;//多流除红
|
||||||
else
|
else
|
||||||
|
@ -276,6 +298,16 @@ int CTwainUI::getPaparSizeIndex(int papersize, int orentation)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TwSS CTwainUI::getcombox_ss(int index)
|
||||||
|
{
|
||||||
|
for (std::map<int, PaperStatus>::iterator it = paperStatusMap.begin(); it != paperStatusMap.end(); it++) {
|
||||||
|
if (it->first == index) {
|
||||||
|
return (TwSS)it->second.Paper;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TwSS::A3;
|
||||||
|
}
|
||||||
|
|
||||||
int CTwainUI::getColorModelIndex(int pixtype)
|
int CTwainUI::getColorModelIndex(int pixtype)
|
||||||
{
|
{
|
||||||
return pixtype == 2 ? 0 : (pixtype == 1 ? 1 : 2);
|
return pixtype == 2 ? 0 : (pixtype == 1 ? 1 : 2);
|
||||||
|
@ -377,6 +409,7 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs)
|
||||||
configItem->Sharpen = m_pageImageProc->m_cmBoxSharpen.GetCurSel();//锐化
|
configItem->Sharpen = m_pageImageProc->m_cmBoxSharpen.GetCurSel();//锐化
|
||||||
configItem->EnOutHole = m_pageImageProc->m_ckbRemoveHole;//除穿孔可用性
|
configItem->EnOutHole = m_pageImageProc->m_ckbRemoveHole;//除穿孔可用性
|
||||||
configItem->OutHoleRatio = WndCtrl2f(&(m_pageImageProc->m_edit_hole)) * 100;//穿孔搜索范围比例系数
|
configItem->OutHoleRatio = WndCtrl2f(&(m_pageImageProc->m_edit_hole)) * 100;//穿孔搜索范围比例系数
|
||||||
|
|
||||||
configItem->EnMultiOutPutR = m_pageImageProc->m_ckbMultioutput;//多流除红
|
configItem->EnMultiOutPutR = m_pageImageProc->m_ckbMultioutput;//多流除红
|
||||||
configItem->EnHsvCorrect = m_pageImageProc->m_ckbHSVCorrect;//答题卡除红
|
configItem->EnHsvCorrect = m_pageImageProc->m_ckbHSVCorrect;//答题卡除红
|
||||||
|
|
||||||
|
@ -430,7 +463,10 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs)
|
||||||
else {
|
else {
|
||||||
settings->imageRotateDegree = 0.0f;
|
settings->imageRotateDegree = 0.0f;
|
||||||
}
|
}
|
||||||
|
settings->AutoCrop_threshold = m_pageImageProc->threshold;
|
||||||
|
settings->noise = m_pageImageProc->noise;
|
||||||
|
settings->indent = m_pageImageProc->indent;
|
||||||
|
settings->is_convex = m_pageImageProc->is_convex;
|
||||||
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->is_dogeardetection = m_pageFeedPaper->dogear.GetCheck();
|
||||||
|
@ -467,7 +503,8 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs)
|
||||||
settings->sharpen = configItem->Sharpen;
|
settings->sharpen = configItem->Sharpen;
|
||||||
if (configItem->Filter != 0 || configItem->EnMultiOutPutR)
|
if (configItem->Filter != 0 || configItem->EnMultiOutPutR)
|
||||||
settings->hardwarecaps.capturepixtype = TWPT_RGB;
|
settings->hardwarecaps.capturepixtype = TWPT_RGB;
|
||||||
|
settings->detachnoise.is_detachnoise = m_pageImageProc->m_ckbDetachNoise;
|
||||||
|
settings->detachnoise.detachnoise = m_pageImageProc->m_slider_detachnoise.m_iPosition;
|
||||||
settings->fillhole.is_fillhole = configItem->EnOutHole;
|
settings->fillhole.is_fillhole = configItem->EnOutHole;
|
||||||
settings->fillhole.fillholeratio = configItem->OutHoleRatio;
|
settings->fillhole.fillholeratio = configItem->OutHoleRatio;
|
||||||
settings->multi_output_red = configItem->EnMultiOutPutR;
|
settings->multi_output_red = configItem->EnMultiOutPutR;
|
||||||
|
|
|
@ -206,6 +206,7 @@ private:
|
||||||
std::vector<CONFIGINFO> cfi;
|
std::vector<CONFIGINFO> cfi;
|
||||||
int getResolutionIndex(int resolution);
|
int getResolutionIndex(int resolution);
|
||||||
int getPaparSizeIndex(int papersize, int orentation);
|
int getPaparSizeIndex(int papersize, int orentation);
|
||||||
|
TwSS getcombox_ss(int index);
|
||||||
int getColorModelIndex(int pixtype);
|
int getColorModelIndex(int pixtype);
|
||||||
int getRotateCmbIndex(float res);
|
int getRotateCmbIndex(float res);
|
||||||
std::vector<CONFIGINFO> getConfigFiles();
|
std::vector<CONFIGINFO> getConfigFiles();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include "filetools.h"
|
||||||
#include "PublicFunc.h"
|
#include "PublicFunc.h"
|
||||||
|
|
||||||
enum tagDevState
|
enum tagDevState
|
||||||
|
@ -110,11 +111,12 @@ public:
|
||||||
void DoEvents() {
|
void DoEvents() {
|
||||||
MSG msg;
|
MSG msg;
|
||||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
if (msg.message != WM_LBUTTONUP && bFilterMsg)
|
//if (msg.message != WM_LBUTTONUP && bFilterMsg)
|
||||||
{
|
//{
|
||||||
bFilterMsg = false;
|
// FileTools::write_log("C:\\Users\\666\\Desktop\\1.txt", to_string(msg.message));
|
||||||
return;
|
// bFilterMsg = false;
|
||||||
}
|
// return;
|
||||||
|
//}
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (m_pImages->empty()) {
|
if (m_pImages->empty()) {
|
||||||
DoEvents();
|
//DoEvents();
|
||||||
this_thread::sleep_for(chrono::milliseconds(1));
|
this_thread::sleep_for(chrono::milliseconds(1));
|
||||||
if (sw.elapsed_s() > 20.00)
|
if (sw.elapsed_s() > 20.00)
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DoEvents();
|
//DoEvents();
|
||||||
this_thread::sleep_for(chrono::milliseconds(2));
|
this_thread::sleep_for(chrono::milliseconds(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,6 +365,16 @@ void GScanO200::config_params(GScanCap& params)
|
||||||
gcap = params;
|
gcap = params;
|
||||||
UINT32 cfgdata = cfg.GetData();
|
UINT32 cfgdata = cfg.GetData();
|
||||||
USBCB usbcb = { CONFIGURED_DATA,cfgdata,0 };
|
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)
|
||||||
|
+ "\nunused_two:" + to_string((cfgdata>>21) & 0x7ff));
|
||||||
m_usb->write_bulk(&usbcb, sizeof(USBCB));
|
m_usb->write_bulk(&usbcb, sizeof(USBCB));
|
||||||
this_thread::sleep_for(std::chrono::milliseconds(200));
|
this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||||
m_pImages->setparam(params);
|
m_pImages->setparam(params);
|
||||||
|
@ -382,10 +392,8 @@ void GScanO200::Scanner_StartScan(UINT16 count)
|
||||||
USBCB status = { GET_DSP_STATUS ,0,0 };
|
USBCB status = { GET_DSP_STATUS ,0,0 };
|
||||||
if (m_usb.get() && m_usb->is_connected())
|
if (m_usb.get() && m_usb->is_connected())
|
||||||
m_usb->write_bulk(&status, sizeof(status));
|
m_usb->write_bulk(&status, sizeof(status));
|
||||||
|
|
||||||
if (m_usb.get() && m_usb->is_connected())
|
if (m_usb.get() && m_usb->is_connected())
|
||||||
m_usb->read_bulk(&status, sizeof(status));
|
m_usb->read_bulk(&status, sizeof(status));
|
||||||
|
|
||||||
switch (status.u32_Data)
|
switch (status.u32_Data)
|
||||||
{
|
{
|
||||||
case COUNT_MODE:
|
case COUNT_MODE:
|
||||||
|
|
|
@ -171,7 +171,7 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
#else // REAL300DPI
|
#else // REAL300DPI
|
||||||
fixedSize = papersize.GetPaperSize(param.papertype, 200.0f, param.paperAlign);
|
fixedSize = papersize.GetPaperSize(param.papertype, 200.0f, param.paperAlign);
|
||||||
#endif
|
#endif
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyAutoCrop(islongcustomcrop ? islongcustomcrop : param.is_autocrop, param.autodescrew, param.fillbackground, cv::Size(fixedSize.cx, fixedSize.cy), true)));
|
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyAutoCrop(islongcustomcrop ? islongcustomcrop : param.is_autocrop, param.autodescrew, param.fillbackground, cv::Size(fixedSize.cx, fixedSize.cy), param.is_convex,param.AutoCrop_threshold,param.noise,param.indent)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param.is_autodiscradblank_normal || param.is_autodiscradblank_vince) {
|
if (param.is_autodiscradblank_normal || param.is_autodiscradblank_vince) {
|
||||||
|
@ -217,7 +217,7 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
//设置参数阈值
|
//设置参数阈值
|
||||||
disBlank->setMinArea(area);
|
disBlank->setMinArea(area);
|
||||||
disBlank->setIntensity(intensity);
|
disBlank->setIntensity(intensity);
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank()));
|
m_iaList.push_back(shared_ptr<CImageApply>(disBlank));
|
||||||
//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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,9 +230,13 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param.brightness != 0 || param.contrast != 0 || param.gamma != 1.0) {
|
if (param.brightness != 0 || param.contrast != 0 || param.gamma != 1.0) {
|
||||||
double aa = (254.0 / 2000.0) * param.brightness + 0.5;
|
double aa = (254 / 2000.0) * param.brightness + 0.5;
|
||||||
int bright = ceil(aa);//[-127,128] 0.128=256.0/2000.0
|
int bright = ceil(aa);//[-127,128] 0.128=256.0/2000.0
|
||||||
int contrast = (int)(param.contrast * 0.036);//[-36,36] 0.036=72.0/2000.0;
|
int contrast=0.0; //= (int)(param.contrast * 0.036);;//[-36,36] 0.036=72.0/2000.0;
|
||||||
|
if(param.contrast<0.0) // 暂不修改对比度,彩色文稿色偏
|
||||||
|
contrast = (int)(param.contrast * 0.036);
|
||||||
|
else
|
||||||
|
contrast = (int)(param.contrast * 0.018);
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyAdjustColors(bright, contrast, param.gamma)));
|
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyAdjustColors(bright, contrast, param.gamma)));
|
||||||
}
|
}
|
||||||
//答题卡除红
|
//答题卡除红
|
||||||
|
@ -248,7 +252,11 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
//二值化
|
//二值化
|
||||||
if (param.pixtype == 0) //threshold
|
if (param.pixtype == 0) //threshold
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyBWBinaray(CImageApplyBWBinaray::ThresholdType::THRESH_BINARY)));
|
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)
|
if (param.resolution_dst != param.resolution_native)
|
||||||
{
|
{
|
||||||
CImageApplyResize* apply;
|
CImageApplyResize* apply;
|
||||||
|
@ -357,7 +365,7 @@ void ImageMatQueue::proc()
|
||||||
writelog("decode image data error");
|
writelog("decode image data error");
|
||||||
}
|
}
|
||||||
#ifdef G200
|
#ifdef G200
|
||||||
resize(mat, mat, cv::Size(), fx, fy);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动
|
cv::resize(mat, mat, cv::Size(), fx, fy);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动
|
||||||
mats.push_back(mat);
|
mats.push_back(mat);
|
||||||
mat.release();
|
mat.release();
|
||||||
#else // G200
|
#else // G200
|
||||||
|
@ -402,8 +410,16 @@ void ImageMatQueue::proc()
|
||||||
for (int j = 0; j < m_iaList.size(); j++) {
|
for (int j = 0; j < m_iaList.size(); j++) {
|
||||||
m_iaList[j]->apply(mats, scanParam.is_duplex);
|
m_iaList[j]->apply(mats, scanParam.is_duplex);
|
||||||
}
|
}
|
||||||
|
//if (scanParam.imageRotateDegree != 0.0 && scanParam.imageRotateDegree != 180.0)
|
||||||
|
//{
|
||||||
|
// //cv::flip(mats[0], mats[0], -1);
|
||||||
|
// transpose(mats[0], mats[0]);
|
||||||
|
// flip(mats[0], mats[0], 1);
|
||||||
|
// transpose(mats[1], mats[1]);
|
||||||
|
// flip(mats[1], mats[1], 0);
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
for (int i = 0; i < mats.size(); i++) {
|
for (int i = 0; i < mats.size(); i++) {
|
||||||
if (!scanParam.is_duplex && i == 1) {
|
if (!scanParam.is_duplex && i == 1) {
|
||||||
mats[i].release();
|
mats[i].release();
|
||||||
|
|
|
@ -27,6 +27,7 @@ using namespace std;
|
||||||
#define DUPLEX "iDuplex"
|
#define DUPLEX "iDuplex"
|
||||||
#define DISCARBLANK "bDiscardBlank"
|
#define DISCARBLANK "bDiscardBlank"
|
||||||
#define DISCARBLANKVINCE "bDiscardBlankVince"
|
#define DISCARBLANKVINCE "bDiscardBlankVince"
|
||||||
|
#define DISCARBLANK_VALUE "discardblank_percent"
|
||||||
#define DB_AREANUM "iAreaNum"
|
#define DB_AREANUM "iAreaNum"
|
||||||
#define DB_DEVNMAX "iDevnMax"
|
#define DB_DEVNMAX "iDevnMax"
|
||||||
#define FLOD "bFlod"
|
#define FLOD "bFlod"
|
||||||
|
@ -50,6 +51,8 @@ using namespace std;
|
||||||
#define MULTIOUTPUT "iMultiOutPut"
|
#define MULTIOUTPUT "iMultiOutPut"
|
||||||
#define OUTHOLE "bOutHole"
|
#define OUTHOLE "bOutHole"
|
||||||
#define OUTHOLERATIO "iOutHoleRatio"
|
#define OUTHOLERATIO "iOutHoleRatio"
|
||||||
|
#define DETACHNOISE "detachnoise"
|
||||||
|
#define DETACHNOISEVALUE "detachnoisevalue"
|
||||||
#define HSVCORRECT "bHsvCorrect"
|
#define HSVCORRECT "bHsvCorrect"
|
||||||
|
|
||||||
//<!送纸选项卡
|
//<!送纸选项卡
|
||||||
|
@ -64,6 +67,10 @@ using namespace std;
|
||||||
#define SCREWLEVEL "iScrewLevel"
|
#define SCREWLEVEL "iScrewLevel"
|
||||||
#define ITEMCAPTION "Caption"
|
#define ITEMCAPTION "Caption"
|
||||||
#define SAVEPATH "SavePath"
|
#define SAVEPATH "SavePath"
|
||||||
|
#define ISCONVEX "isConvex"
|
||||||
|
#define INDENT "Indent"
|
||||||
|
#define AUTOCROP_THRESHOLD "AutoCrop_Threshold"
|
||||||
|
#define NOISE "Noise"
|
||||||
|
|
||||||
|
|
||||||
/******************
|
/******************
|
||||||
|
@ -125,6 +132,12 @@ typedef struct tagFillHole
|
||||||
int fillholeratio;
|
int fillholeratio;
|
||||||
}FillHole;
|
}FillHole;
|
||||||
|
|
||||||
|
typedef struct tagDetachNoise
|
||||||
|
{
|
||||||
|
byte is_detachnoise;
|
||||||
|
int detachnoise;
|
||||||
|
}DetachNoise;
|
||||||
|
|
||||||
typedef struct tagHARDWAREPARAMS
|
typedef struct tagHARDWAREPARAMS
|
||||||
{
|
{
|
||||||
byte capturepixtype;
|
byte capturepixtype;
|
||||||
|
@ -191,11 +204,16 @@ struct GScanCap
|
||||||
byte sharpen;
|
byte sharpen;
|
||||||
byte enhance_color; /**< 颜色增强*/
|
byte enhance_color; /**< 颜色增强*/
|
||||||
byte fillbackground; /**< 填黑框*/
|
byte fillbackground; /**< 填黑框*/
|
||||||
|
bool is_convex; /**< 填黑框模式,true为凸多边形填充,false为凹多边形填充,默认true*/
|
||||||
|
int noise; /**< 除噪像素,能够消除noise宽度的背景竖条纹干扰,默认40*/
|
||||||
|
int indent; /**< 轮廓缩进,裁剪、纠偏或者黑底填充时,对探索到的纸张轮廓进行缩进indent像素,默认5*/
|
||||||
|
int AutoCrop_threshold; /**< 自动裁剪二值化阈值,取值范围(0, 255),默认40*/
|
||||||
unsigned short scannum; /**< 扫描张数*/
|
unsigned short scannum; /**< 扫描张数*/
|
||||||
byte is_backrotate180; /**< 背面旋转180*/
|
byte is_backrotate180; /**< 背面旋转180*/
|
||||||
byte is_dogeardetection; /**<折角检测*/
|
byte is_dogeardetection; /**<折角检测*/
|
||||||
HardwareCaps hardwarecaps; /**< 硬件扫描参数*/
|
HardwareCaps hardwarecaps; /**< 硬件扫描参数*/
|
||||||
FillHole fillhole;
|
FillHole fillhole;
|
||||||
|
DetachNoise detachnoise; /**< 黑白降噪*/
|
||||||
byte is_autotext; /**< 自动文本方向识别*/
|
byte is_autotext; /**< 自动文本方向识别*/
|
||||||
std::string Caption;
|
std::string Caption;
|
||||||
std::string SavePath;
|
std::string SavePath;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "UsbScanEx.h"
|
#include "UsbScanEx.h"
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
|
#include "filetools.h"
|
||||||
|
|
||||||
UsbScanEx::UsbScanEx(int index)
|
UsbScanEx::UsbScanEx(int index)
|
||||||
{
|
{
|
||||||
|
@ -79,6 +80,7 @@ bool UsbScanEx::open()
|
||||||
CloseHandle(m_h_dev);
|
CloseHandle(m_h_dev);
|
||||||
m_h_dev = INVALID_HANDLE_VALUE;
|
m_h_dev = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
FileTools::write_log("USB Open!");
|
||||||
return m_h_dev;
|
return m_h_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +133,7 @@ bool UsbScanEx::close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_b_is_connected = FALSE;
|
m_b_is_connected = FALSE;
|
||||||
|
FileTools::write_log("USB Close!");
|
||||||
return b_ret;
|
return b_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,10 +153,10 @@ int UsbScanEx::read_bulk(void* data, int len)
|
||||||
lp_overlap->Offset = 0;
|
lp_overlap->Offset = 0;
|
||||||
lp_overlap->OffsetHigh = 0;
|
lp_overlap->OffsetHigh = 0;
|
||||||
lp_overlap->Pointer = 0;
|
lp_overlap->Pointer = 0;
|
||||||
|
|
||||||
if (m_h_dev != NULL) {
|
if (m_h_dev != NULL) {
|
||||||
b_ret = ReadFile(h_pipe, data, len, &pdw_ret, lp_overlap);
|
b_ret = ReadFile(h_pipe, data, len, &pdw_ret, lp_overlap);
|
||||||
|
|
||||||
if (b_ret) {
|
if (b_ret) {
|
||||||
return pdw_ret;
|
return pdw_ret;
|
||||||
}
|
}
|
||||||
|
@ -187,12 +190,9 @@ int UsbScanEx::write_bulk(void* data, int len)
|
||||||
HANDLE h_pipe = m_usb_pipes[BULK_OUT].h_pipe;
|
HANDLE h_pipe = m_usb_pipes[BULK_OUT].h_pipe;
|
||||||
void* p_data = data;
|
void* p_data = data;
|
||||||
unsigned long dw_size = len;
|
unsigned long dw_size = len;
|
||||||
|
|
||||||
LPOVERLAPPED lp_overlap = ov + BULK_OUT;
|
LPOVERLAPPED lp_overlap = ov + BULK_OUT;
|
||||||
|
|
||||||
if (m_h_dev == INVALID_HANDLE_VALUE)
|
if (m_h_dev == INVALID_HANDLE_VALUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
b_ret = WriteFile(h_pipe, p_data, dw_size, &dw_size, lp_overlap);
|
b_ret = WriteFile(h_pipe, p_data, dw_size, &dw_size, lp_overlap);
|
||||||
if (b_ret) {
|
if (b_ret) {
|
||||||
return dw_size;
|
return dw_size;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "PublicFunc.h"
|
||||||
|
|
||||||
class FileTools
|
class FileTools
|
||||||
{
|
{
|
||||||
|
@ -16,18 +17,28 @@ public:
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void write_log(std::string log)
|
||||||
|
{
|
||||||
|
TCHAR szIniFile[MAX_PATH] = { 0 };
|
||||||
|
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_LOCAL_APPDATA, TRUE);
|
||||||
|
_tcscat(szIniFile, HUAGAO_SCAN);
|
||||||
|
_tcscat(szIniFile, TWAIN_INIPATH);
|
||||||
|
_tcscat(szIniFile, TEXT("\\"));
|
||||||
|
_tcscat(szIniFile, TWAIN_LOG_NAME);
|
||||||
|
std::string savepath = TCHAR2STRING(szIniFile);
|
||||||
|
write_log(savepath, log);
|
||||||
|
}
|
||||||
static void write_log(std::string filename, std::string log)
|
static void write_log(std::string filename, std::string log)
|
||||||
{
|
{
|
||||||
//std::string savepath;
|
//std::string savepath;
|
||||||
//std::string str = "D:";
|
//std::string str = "D:";
|
||||||
//savepath = str+"\\"+filename;
|
//savepath = str+"\\"+filename;
|
||||||
std::ofstream ofs(filename, std::ios::app);
|
std::ofstream ofs(filename, std::ios::app);
|
||||||
|
|
||||||
time_t timp;
|
time_t timp;
|
||||||
struct tm* p;
|
struct tm* p;
|
||||||
time(&timp);
|
time(&timp);
|
||||||
p=localtime(&timp);
|
p=localtime(&timp);
|
||||||
ofs << p->tm_year << "/" << p->tm_mon << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<<log << std::endl;
|
ofs << p->tm_year+1900 << "/" << p->tm_mon+1 << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<<log << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -26,6 +26,7 @@ GScanCap GscanJsonConfig::GetDefaultGscancapValue()
|
||||||
gcap.is_duplex = TRUE;
|
gcap.is_duplex = TRUE;
|
||||||
gcap.is_autodiscradblank_normal = FALSE;
|
gcap.is_autodiscradblank_normal = FALSE;
|
||||||
gcap.is_autodiscradblank_vince = FALSE;
|
gcap.is_autodiscradblank_vince = FALSE;
|
||||||
|
gcap.discardblank_percent = 20;
|
||||||
gcap.is_switchfrontback = FALSE;
|
gcap.is_switchfrontback = FALSE;
|
||||||
gcap.resolution_dst = 200.0f;
|
gcap.resolution_dst = 200.0f;
|
||||||
gcap.resolution_native = 200.0f;
|
gcap.resolution_native = 200.0f;
|
||||||
|
@ -44,6 +45,8 @@ GScanCap GscanJsonConfig::GetDefaultGscancapValue()
|
||||||
gcap.fillbackground = TRUE;//默认不填黑框
|
gcap.fillbackground = TRUE;//默认不填黑框
|
||||||
gcap.fillhole.is_fillhole = FALSE;
|
gcap.fillhole.is_fillhole = FALSE;
|
||||||
gcap.fillhole.fillholeratio = 10;
|
gcap.fillhole.fillholeratio = 10;
|
||||||
|
gcap.detachnoise.detachnoise = 30;
|
||||||
|
gcap.detachnoise.is_detachnoise = FALSE;
|
||||||
gcap.filter = 3;//对应Filter::None
|
gcap.filter = 3;//对应Filter::None
|
||||||
gcap.multi_output_red = FALSE;
|
gcap.multi_output_red = FALSE;
|
||||||
gcap.sharpen = SharpenBlur::Sharpen_None;
|
gcap.sharpen = SharpenBlur::Sharpen_None;
|
||||||
|
@ -58,6 +61,10 @@ 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.AutoCrop_threshold = 40;
|
||||||
|
gcap.is_convex = TRUE;
|
||||||
|
gcap.noise = 40;
|
||||||
|
gcap.indent = 5;
|
||||||
gcap.is_dogeardetection = FALSE;
|
gcap.is_dogeardetection = FALSE;
|
||||||
gcap.scannum = -1;//默认连续扫描
|
gcap.scannum = -1;//默认连续扫描
|
||||||
//gcap.scanrect = { 0 };
|
//gcap.scanrect = { 0 };
|
||||||
|
@ -96,6 +103,8 @@ void GscanJsonConfig::SaveGscanCapConfig(const GScanCap & gcap, const std::strin
|
||||||
outJson["Config"].Add(MULTIOUTPUT, (bool)(gcap.multi_output_red), false);
|
outJson["Config"].Add(MULTIOUTPUT, (bool)(gcap.multi_output_red), false);
|
||||||
outJson["Config"].Add(OUTHOLE, (bool)(gcap.fillhole.is_fillhole), false);
|
outJson["Config"].Add(OUTHOLE, (bool)(gcap.fillhole.is_fillhole), false);
|
||||||
outJson["Config"].Add(OUTHOLERATIO, (int)(gcap.fillhole.fillholeratio));
|
outJson["Config"].Add(OUTHOLERATIO, (int)(gcap.fillhole.fillholeratio));
|
||||||
|
outJson["Config"].Add(DETACHNOISE, (bool)(gcap.detachnoise.is_detachnoise), false);
|
||||||
|
outJson["Config"].Add(DETACHNOISEVALUE, (int)(gcap.detachnoise.detachnoise));
|
||||||
outJson["Config"].Add(HSVCORRECT, (bool)(gcap.hsvcorrect),false);
|
outJson["Config"].Add(HSVCORRECT, (bool)(gcap.hsvcorrect),false);
|
||||||
|
|
||||||
outJson["Config"].Add(ULTRADETECT, (bool)(gcap.hardwarecaps.en_doublefeed), false);
|
outJson["Config"].Add(ULTRADETECT, (bool)(gcap.hardwarecaps.en_doublefeed), false);
|
||||||
|
@ -104,6 +113,10 @@ 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(NOISE, (int)(gcap.noise), false);
|
||||||
|
outJson["Config"].Add(ISCONVEX, (bool)(gcap.is_convex), false);
|
||||||
|
outJson["Config"].Add(INDENT, (int)(gcap.indent), false);
|
||||||
|
outJson["Config"].Add(AUTOCROP_THRESHOLD, (int)(gcap.AutoCrop_threshold), false);
|
||||||
outJson["Config"].Add(DOGEAR_DETECTION, (bool)(gcap.is_dogeardetection), 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));
|
||||||
|
@ -128,11 +141,13 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
||||||
root["Config"].AddEmptySubArray(DUPLEX);
|
root["Config"].AddEmptySubArray(DUPLEX);
|
||||||
root["Config"].AddEmptySubArray(DISCARBLANK);
|
root["Config"].AddEmptySubArray(DISCARBLANK);
|
||||||
root["Config"].AddEmptySubArray(DISCARBLANKVINCE);
|
root["Config"].AddEmptySubArray(DISCARBLANKVINCE);
|
||||||
|
root["Config"].AddEmptySubArray(DISCARBLANK_VALUE);
|
||||||
//root["Config"].AddEmptySubArray(DB_AREANUM);
|
//root["Config"].AddEmptySubArray(DB_AREANUM);
|
||||||
//root["Config"].AddEmptySubArray(DB_DEVNMAX);
|
//root["Config"].AddEmptySubArray(DB_DEVNMAX);
|
||||||
root["Config"].AddEmptySubArray(FLOD);
|
root["Config"].AddEmptySubArray(FLOD);
|
||||||
root["Config"].AddEmptySubArray(SWITCHFRONTBACK);
|
root["Config"].AddEmptySubArray(SWITCHFRONTBACK);
|
||||||
|
root["Config"].AddEmptySubArray(DETACHNOISE);
|
||||||
|
root["Config"].AddEmptySubArray(DETACHNOISEVALUE);
|
||||||
/*< brightness setting*/
|
/*< brightness setting*/
|
||||||
root["Config"].AddEmptySubArray(BRIGHTNESS);
|
root["Config"].AddEmptySubArray(BRIGHTNESS);
|
||||||
root["Config"].AddEmptySubArray(AUTOCONTRAST);
|
root["Config"].AddEmptySubArray(AUTOCONTRAST);
|
||||||
|
@ -160,6 +175,11 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
||||||
root["Config"].AddEmptySubArray(DOGEAR_DETECTION);
|
root["Config"].AddEmptySubArray(DOGEAR_DETECTION);
|
||||||
root["Config"].AddEmptySubArray(SCREWDETECT);
|
root["Config"].AddEmptySubArray(SCREWDETECT);
|
||||||
root["Config"].AddEmptySubArray(SCREWLEVEL);
|
root["Config"].AddEmptySubArray(SCREWLEVEL);
|
||||||
|
root["Config"].AddEmptySubArray(NOISE);
|
||||||
|
root["Config"].AddEmptySubArray(INDENT);
|
||||||
|
root["Config"].AddEmptySubArray(AUTOCROP_THRESHOLD);
|
||||||
|
root["Config"].AddEmptySubArray(ISCONVEX);
|
||||||
|
|
||||||
|
|
||||||
/*< other settings*/
|
/*< other settings*/
|
||||||
root["Config"].AddEmptySubArray(ITEMCAPTION);
|
root["Config"].AddEmptySubArray(ITEMCAPTION);
|
||||||
|
@ -174,6 +194,7 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
||||||
root["Config"][DUPLEX].Add(i,(bool)cfgArray[i].is_duplex);
|
root["Config"][DUPLEX].Add(i,(bool)cfgArray[i].is_duplex);
|
||||||
root["Config"][DISCARBLANK].Add(i, (bool)cfgArray[i].is_autodiscradblank_normal);
|
root["Config"][DISCARBLANK].Add(i, (bool)cfgArray[i].is_autodiscradblank_normal);
|
||||||
root["Config"][DISCARBLANKVINCE].Add(i, (bool)cfgArray[i].is_autodiscradblank_vince);
|
root["Config"][DISCARBLANKVINCE].Add(i, (bool)cfgArray[i].is_autodiscradblank_vince);
|
||||||
|
root["Config"][DISCARBLANK_VALUE].Add((int)cfgArray[i].discardblank_percent);
|
||||||
//root["Config"][DB_AREANUM].Add(cfgArray[i].DBlank_AreaNum);
|
//root["Config"][DB_AREANUM].Add(cfgArray[i].DBlank_AreaNum);
|
||||||
//root["Config"][DB_DEVNMAX].Add(cfgArray[i].DBlank_DevnMax);
|
//root["Config"][DB_DEVNMAX].Add(cfgArray[i].DBlank_DevnMax);
|
||||||
root["Config"][FLOD].Add(i, (bool)cfgArray[i].en_fold);
|
root["Config"][FLOD].Add(i, (bool)cfgArray[i].en_fold);
|
||||||
|
@ -192,6 +213,8 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
||||||
root["Config"][MULTIOUTPUT].Add(i, (bool)cfgArray[i].multi_output_red);
|
root["Config"][MULTIOUTPUT].Add(i, (bool)cfgArray[i].multi_output_red);
|
||||||
root["Config"][OUTHOLE].Add(i, (bool)cfgArray[i].fillhole.is_fillhole);
|
root["Config"][OUTHOLE].Add(i, (bool)cfgArray[i].fillhole.is_fillhole);
|
||||||
root["Config"][OUTHOLERATIO].Add((int)cfgArray[i].fillhole.fillholeratio);
|
root["Config"][OUTHOLERATIO].Add((int)cfgArray[i].fillhole.fillholeratio);
|
||||||
|
root["Config"][DETACHNOISE].Add(i, (bool)cfgArray[i].detachnoise.is_detachnoise);
|
||||||
|
root["Config"][DETACHNOISEVALUE].Add((int)cfgArray[i].detachnoise.detachnoise);
|
||||||
root["Config"][HSVCORRECT].Add(i, (bool)cfgArray[i].hsvcorrect);
|
root["Config"][HSVCORRECT].Add(i, (bool)cfgArray[i].hsvcorrect);
|
||||||
|
|
||||||
root["Config"][ULTRADETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_doublefeed);
|
root["Config"][ULTRADETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_doublefeed);
|
||||||
|
@ -200,6 +223,10 @@ 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"][NOISE].Add((int)cfgArray[i].noise);
|
||||||
|
root["Config"][INDENT].Add((int)cfgArray[i].indent);
|
||||||
|
root["Config"][ISCONVEX].Add(i, (bool)cfgArray[i].is_convex);
|
||||||
|
root["Config"][AUTOCROP_THRESHOLD].Add((int)cfgArray[i].AutoCrop_threshold);
|
||||||
root["Config"][DOGEAR_DETECTION].Add(i, (bool)cfgArray[i].is_dogeardetection);
|
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);
|
||||||
|
@ -312,6 +339,9 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
root["Config"].Get(FLOD, itmEnFlod);
|
root["Config"].Get(FLOD, itmEnFlod);
|
||||||
neb::CJsonObject itmEnSwitchFrontBack;
|
neb::CJsonObject itmEnSwitchFrontBack;
|
||||||
root["Config"].Get(SWITCHFRONTBACK, itmEnSwitchFrontBack);
|
root["Config"].Get(SWITCHFRONTBACK, itmEnSwitchFrontBack);
|
||||||
|
neb::CJsonObject itmdiscarbrank_value;
|
||||||
|
root["Config"].Get(DISCARBLANK_VALUE, itmdiscarbrank_value);
|
||||||
|
|
||||||
|
|
||||||
neb::CJsonObject itmBrtnes;
|
neb::CJsonObject itmBrtnes;
|
||||||
root["Config"].Get(BRIGHTNESS, itmBrtnes);
|
root["Config"].Get(BRIGHTNESS, itmBrtnes);
|
||||||
|
@ -338,6 +368,10 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
root["Config"].Get(OUTHOLE, itmOutHole);
|
root["Config"].Get(OUTHOLE, itmOutHole);
|
||||||
neb::CJsonObject itmOutHoleRatio;
|
neb::CJsonObject itmOutHoleRatio;
|
||||||
root["Config"].Get(OUTHOLERATIO, itmOutHoleRatio);
|
root["Config"].Get(OUTHOLERATIO, itmOutHoleRatio);
|
||||||
|
neb::CJsonObject itmDetachNoise;
|
||||||
|
root["Config"].Get(DETACHNOISE, itmDetachNoise);
|
||||||
|
neb::CJsonObject itmDetachNoiseValue;
|
||||||
|
root["Config"].Get(DETACHNOISEVALUE, itmDetachNoiseValue);
|
||||||
neb::CJsonObject itmHsvCorrect;
|
neb::CJsonObject itmHsvCorrect;
|
||||||
root["Config"].Get(HSVCORRECT, itmHsvCorrect);
|
root["Config"].Get(HSVCORRECT, itmHsvCorrect);
|
||||||
|
|
||||||
|
@ -353,6 +387,14 @@ 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 itmNoise;
|
||||||
|
root["Config"].Get(NOISE, itmNoise);
|
||||||
|
neb::CJsonObject itmIndent;
|
||||||
|
root["Config"].Get(INDENT, itmIndent);
|
||||||
|
neb::CJsonObject itmisConvex;
|
||||||
|
root["Config"].Get(ISCONVEX, itmisConvex);
|
||||||
|
neb::CJsonObject itmAutoCrop_t;
|
||||||
|
root["Config"].Get(AUTOCROP_THRESHOLD, itmAutoCrop_t);
|
||||||
neb::CJsonObject itmdogeardetection;
|
neb::CJsonObject itmdogeardetection;
|
||||||
root["Config"].Get(DOGEAR_DETECTION, itmdogeardetection);
|
root["Config"].Get(DOGEAR_DETECTION, itmdogeardetection);
|
||||||
neb::CJsonObject itmScrewDetct;
|
neb::CJsonObject itmScrewDetct;
|
||||||
|
@ -390,6 +432,8 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.resolution_dst = i_value;
|
cfp.resolution_dst = i_value;
|
||||||
itmDulpex.Get(i, b_value);
|
itmDulpex.Get(i, b_value);
|
||||||
cfp.is_duplex = b_value ? 1 : 0;
|
cfp.is_duplex = b_value ? 1 : 0;
|
||||||
|
itmdiscarbrank_value.Get(i, i_value);
|
||||||
|
cfp.discardblank_percent = i_value;
|
||||||
itmDiscardBlk.Get(i, b_value);
|
itmDiscardBlk.Get(i, b_value);
|
||||||
cfp.is_autodiscradblank_normal = b_value ? 1 : 0;
|
cfp.is_autodiscradblank_normal = b_value ? 1 : 0;
|
||||||
itmDiscardBlkVince.Get(i, b_value);
|
itmDiscardBlkVince.Get(i, b_value);
|
||||||
|
@ -428,6 +472,10 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.fillhole.is_fillhole = b_value ? 1 : 0;
|
cfp.fillhole.is_fillhole = b_value ? 1 : 0;
|
||||||
itmOutHoleRatio.Get(i, i_value);
|
itmOutHoleRatio.Get(i, i_value);
|
||||||
cfp.fillhole.fillholeratio = i_value;
|
cfp.fillhole.fillholeratio = i_value;
|
||||||
|
itmDetachNoise.Get(i, b_value);
|
||||||
|
cfp.detachnoise.is_detachnoise = b_value ? 1 : 0;
|
||||||
|
itmDetachNoiseValue.Get(i, i_value);
|
||||||
|
cfp.detachnoise.detachnoise = i_value;
|
||||||
itmHsvCorrect.Get(i, b_value);
|
itmHsvCorrect.Get(i, b_value);
|
||||||
cfp.hsvcorrect = b_value ? 1 : 0;
|
cfp.hsvcorrect = b_value ? 1 : 0;
|
||||||
|
|
||||||
|
@ -439,10 +487,18 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.scannum = i_value;
|
cfp.scannum = i_value;
|
||||||
itmDocOrientation.Get(i, i_value);
|
itmDocOrientation.Get(i, i_value);
|
||||||
cfp.imageRotateDegree = i_value;
|
cfp.imageRotateDegree = i_value;
|
||||||
|
itmAutoCrop_t.Get(i, i_value);
|
||||||
|
cfp.AutoCrop_threshold = i_value;
|
||||||
|
itmNoise.Get(i, i_value);
|
||||||
|
cfp.noise = i_value;
|
||||||
|
itmIndent.Get(i, i_value);
|
||||||
|
cfp.indent = i_value;
|
||||||
itmAutotext.Get(i, b_value);
|
itmAutotext.Get(i, b_value);
|
||||||
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;
|
||||||
|
itmisConvex.Get(i, b_value);
|
||||||
|
cfp.is_convex = b_value ? 1 : 0;
|
||||||
itmdogeardetection.Get(i, b_value);
|
itmdogeardetection.Get(i, b_value);
|
||||||
cfp.is_dogeardetection = b_value ? 1 : 0;
|
cfp.is_dogeardetection = b_value ? 1 : 0;
|
||||||
itmScrewDetct.Get(i, b_value);
|
itmScrewDetct.Get(i, b_value);
|
||||||
|
@ -487,6 +543,8 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.is_autodiscradblank_normal = bvalue?1:0;
|
cfp.is_autodiscradblank_normal = bvalue?1:0;
|
||||||
root["Config"].Get(DISCARBLANKVINCE, bvalue);
|
root["Config"].Get(DISCARBLANKVINCE, bvalue);
|
||||||
cfp.is_autodiscradblank_vince = bvalue?1:0;
|
cfp.is_autodiscradblank_vince = bvalue?1:0;
|
||||||
|
root["Config"].Get(DISCARBLANK_VALUE, index);
|
||||||
|
cfp.discardblank_percent = index ;
|
||||||
//root["Config"].Get(DB_AREANUM, index);
|
//root["Config"].Get(DB_AREANUM, index);
|
||||||
//cfp.DBlank_AreaNum = index;
|
//cfp.DBlank_AreaNum = index;
|
||||||
//root["Config"].Get(DB_DEVNMAX, index);
|
//root["Config"].Get(DB_DEVNMAX, index);
|
||||||
|
@ -521,9 +579,18 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
||||||
cfp.fillhole.is_fillhole = bvalue?1:0;
|
cfp.fillhole.is_fillhole = bvalue?1:0;
|
||||||
root["Config"].Get(OUTHOLERATIO, index);
|
root["Config"].Get(OUTHOLERATIO, index);
|
||||||
cfp.fillhole.fillholeratio = index;
|
cfp.fillhole.fillholeratio = index;
|
||||||
|
root["Config"].Get(DETACHNOISE, bvalue);
|
||||||
|
cfp.detachnoise.is_detachnoise = bvalue ? 1 : 0;
|
||||||
|
root["Config"].Get(DETACHNOISEVALUE, index);
|
||||||
|
cfp.detachnoise.detachnoise = index;
|
||||||
root["Config"].Get(HSVCORRECT, bvalue);
|
root["Config"].Get(HSVCORRECT, bvalue);
|
||||||
cfp.hsvcorrect = bvalue ? 1 : 0;
|
cfp.hsvcorrect = bvalue ? 1 : 0;
|
||||||
|
root["Config"].Get(NOISE, index);
|
||||||
|
cfp.noise = index;
|
||||||
|
root["Config"].Get(INDENT, index);
|
||||||
|
cfp.indent = index;
|
||||||
|
root["Config"].Get(AUTOCROP_THRESHOLD, index);
|
||||||
|
cfp.AutoCrop_threshold = index;
|
||||||
|
|
||||||
root["Config"].Get(ULTRADETECT, bvalue);
|
root["Config"].Get(ULTRADETECT, bvalue);
|
||||||
cfp.hardwarecaps.en_doublefeed = bvalue?1:0;
|
cfp.hardwarecaps.en_doublefeed = bvalue?1:0;
|
||||||
|
@ -537,6 +604,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(ISCONVEX, bvalue);
|
||||||
|
cfp.is_convex = bvalue ? 1 : 0;
|
||||||
root["Config"].Get(DOGEAR_DETECTION, bvalue);
|
root["Config"].Get(DOGEAR_DETECTION, bvalue);
|
||||||
cfp.is_dogeardetection = bvalue ? 1 : 0;
|
cfp.is_dogeardetection = bvalue ? 1 : 0;
|
||||||
root["Config"].Get(SCREWDETECT, bvalue);
|
root["Config"].Get(SCREWDETECT, bvalue);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "ImageApplyAutoCrop.h"
|
#include "ImageApplyAutoCrop.h"
|
||||||
#include "ImageProcess_Public.h"
|
#include "ImageProcess_Public.h"
|
||||||
|
|
||||||
#define RE 2
|
|
||||||
|
|
||||||
CImageApplyAutoCrop::CImageApplyAutoCrop()
|
CImageApplyAutoCrop::CImageApplyAutoCrop()
|
||||||
: m_isCrop(false)
|
: m_isCrop(false)
|
||||||
, m_isDesaskew(false)
|
, m_isDesaskew(false)
|
||||||
|
@ -32,45 +30,27 @@ CImageApplyAutoCrop::~CImageApplyAutoCrop()
|
||||||
|
|
||||||
void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
||||||
{
|
{
|
||||||
#ifdef LOG
|
(void)side;
|
||||||
FileTools::write_log("imgprc.txt", "enter CImageApplyAutoCrop apply");
|
if (pDib.empty()) return;
|
||||||
#endif // LOG
|
if (!m_isCrop && !m_isDesaskew && !m_isFillBlank && m_fixedSize.empty()) return;
|
||||||
if (pDib.empty())
|
|
||||||
{
|
|
||||||
#ifdef LOG
|
|
||||||
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply");
|
|
||||||
#endif // LOG
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::Mat src = pDib;
|
cv::Mat src = pDib;
|
||||||
|
cv::Mat thre;
|
||||||
cv::Mat dst;
|
cv::Mat dst;
|
||||||
cv::Mat src_resize;
|
hg::threshold_Mat(src, thre, m_threshold);
|
||||||
cv::resize(src, src_resize, cv::Size(src.cols / RE, src.rows / RE));
|
|
||||||
cv::Mat scale_mat;
|
|
||||||
cv::Mat thre(src_resize.size(), CV_8UC1);
|
|
||||||
hg::threshold_Mat(src_resize, thre, m_threshold);
|
|
||||||
src_resize.release();
|
|
||||||
|
|
||||||
if (m_noise > RE)
|
if (m_noise > 0)
|
||||||
{
|
{
|
||||||
cv::Mat element = getStructuringElement(cv::MORPH_RECT, cv::Size(m_noise / RE, m_noise / RE));
|
cv::Mat element = getStructuringElement(cv::MORPH_RECT, cv::Size(m_noise, m_noise));
|
||||||
cv::morphologyEx(thre, thre, cv::MORPH_OPEN, element);
|
cv::morphologyEx(thre, thre, cv::MORPH_OPEN, element);
|
||||||
element.release();
|
|
||||||
}
|
}
|
||||||
std::vector<cv::Vec4i> hierarchy;
|
std::vector<cv::Vec4i> hierarchy;
|
||||||
std::vector<std::vector<cv::Point>> contours;
|
std::vector<std::vector<cv::Point>> contours;
|
||||||
|
|
||||||
hg::findContours(thre, contours, hierarchy, cv::RETR_EXTERNAL);
|
hg::findContours(thre, contours, hierarchy, cv::RETR_EXTERNAL);
|
||||||
std::vector<cv::Point> maxContour = hg::getMaxContour(contours, hierarchy);
|
m_maxContour = hg::getMaxContour(contours, hierarchy);
|
||||||
|
|
||||||
for (cv::Point& item : maxContour)
|
if (m_maxContour.size() == 0)
|
||||||
{
|
|
||||||
item.x = item.x * RE - RE / 2;
|
|
||||||
item.y = item.y * RE - RE / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxContour.size() == 0)
|
|
||||||
{
|
{
|
||||||
thre.release();
|
thre.release();
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
|
@ -81,9 +61,14 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
||||||
thre.release();
|
thre.release();
|
||||||
dst.release();
|
dst.release();
|
||||||
|
|
||||||
cv::RotatedRect rect = hg::getBoundingRect(maxContour);
|
cv::RotatedRect rect = hg::getBoundingRect(m_maxContour);
|
||||||
|
cv::Rect boudingRect = cv::boundingRect(m_maxContour);
|
||||||
|
boudingRect.x -= 1;
|
||||||
|
boudingRect.y -= 1;
|
||||||
|
boudingRect.width += 2;
|
||||||
|
boudingRect.height += 2;
|
||||||
|
|
||||||
if (m_isDesaskew)
|
if (m_isDesaskew && rect.angle != 0)
|
||||||
{
|
{
|
||||||
cv::Point2f srcTri[4];
|
cv::Point2f srcTri[4];
|
||||||
cv::Point2f dstTri[3];
|
cv::Point2f dstTri[3];
|
||||||
|
@ -92,57 +77,71 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
||||||
dstTri[0] = cv::Point2f(0, rect.size.height - 1);
|
dstTri[0] = cv::Point2f(0, rect.size.height - 1);
|
||||||
dstTri[1] = cv::Point2f(0, 0);
|
dstTri[1] = cv::Point2f(0, 0);
|
||||||
dstTri[2] = cv::Point2f(rect.size.width - 1, 0);
|
dstTri[2] = cv::Point2f(rect.size.width - 1, 0);
|
||||||
|
|
||||||
cv::Mat warp_mat;
|
cv::Mat warp_mat;
|
||||||
warp_mat = cv::getAffineTransform(srcTri, dstTri);
|
warp_mat = cv::getAffineTransform(srcTri, dstTri);
|
||||||
cv::warpAffine(src, dst, warp_mat, rect.size);
|
cv::warpAffine(src, dst, warp_mat, rect.size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dst = src(rect.boundingRect() & cv::Rect(0, 0, src.cols, src.rows));
|
dst = src(boudingRect & cv::Rect(0, 0, src.cols, src.rows));
|
||||||
|
|
||||||
|
m_maxContour.clear();
|
||||||
|
m_maxContour.push_back(cv::Point(-1, dst.rows));
|
||||||
|
m_maxContour.push_back(cv::Point(-1, -1));
|
||||||
|
m_maxContour.push_back(cv::Point(dst.cols, -1));
|
||||||
|
m_maxContour.push_back(cv::Point(dst.cols, dst.rows));
|
||||||
|
|
||||||
if (m_isFillBlank)
|
if (m_isFillBlank)
|
||||||
{
|
{
|
||||||
cv::Mat thre_dst;
|
cv::Mat thre_dst;
|
||||||
hg::threshold_Mat(dst, thre_dst, m_threshold);
|
hg::threshold_Mat(dst, thre_dst, m_threshold);
|
||||||
cv::erode(thre_dst, thre_dst, cv::Mat(), cv::Point(-1, -1), m_indent);
|
|
||||||
|
if (m_indent > 0)
|
||||||
|
{
|
||||||
|
std::vector<cv::Point> rectEdge{ cv::Point(0, 0) ,cv::Point(thre_dst.cols - 1, 0),
|
||||||
|
cv::Point(thre_dst.cols - 1, thre_dst.rows - 1), cv::Point(0, thre_dst.rows - 1) };
|
||||||
|
std::vector<std::vector<cv::Point>> rectEdges{ rectEdge };
|
||||||
|
cv::drawContours(thre_dst, rectEdges, 0, cv::Scalar::all(0));
|
||||||
|
cv::Mat element = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(m_indent * 2, m_indent * 2));
|
||||||
|
cv::erode(thre_dst, thre_dst, element, cv::Point(-1, -1), 1);
|
||||||
|
}
|
||||||
hierarchy.clear();
|
hierarchy.clear();
|
||||||
contours.clear();
|
contours.clear();
|
||||||
maxContour.clear();
|
m_maxContour.clear();
|
||||||
|
|
||||||
hg::findContours(thre_dst, contours, hierarchy, cv::RETR_EXTERNAL);
|
hg::findContours(thre_dst, contours, hierarchy, cv::RETR_EXTERNAL);
|
||||||
thre_dst.release();
|
|
||||||
|
|
||||||
maxContour = hg::getMaxContour(contours, hierarchy);
|
|
||||||
if (m_isConvexHull)
|
if (m_isConvexHull)
|
||||||
hg::convexHull(maxContour, maxContour);
|
{
|
||||||
|
m_maxContour = hg::getMaxContour(contours, hierarchy);
|
||||||
|
hg::convexHull(m_maxContour, m_maxContour);
|
||||||
|
contours.clear();
|
||||||
|
contours.push_back(m_maxContour);
|
||||||
|
}
|
||||||
|
|
||||||
contours.clear();
|
contours.push_back(std::vector<cv::Point>());
|
||||||
contours.resize(2);
|
contours[contours.size() - 1].push_back(cv::Point(-1, dst.rows - 1));
|
||||||
contours[0] = maxContour;
|
contours[contours.size() - 1].push_back(cv::Point(-1, -1));
|
||||||
contours[1].push_back(cv::Point(0, dst.rows - 1));
|
contours[contours.size() - 1].push_back(cv::Point(dst.cols, -1));
|
||||||
contours[1].push_back(cv::Point(0, 0));
|
contours[contours.size() - 1].push_back(cv::Point(dst.cols, dst.rows));
|
||||||
contours[1].push_back(cv::Point(dst.cols - 1, 0));
|
|
||||||
contours[1].push_back(cv::Point(dst.cols - 1, dst.rows - 1));
|
|
||||||
|
|
||||||
hg::fillPolys(dst, contours, cv::Scalar(255, 255, 255));
|
hg::fillPolys(dst, contours, cv::Scalar(255, 255, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
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)*/ m_isCrop)
|
||||||
{
|
|
||||||
pDib = dst.clone();
|
pDib = dst.clone();
|
||||||
dst.release();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (m_isCrop && side == 1 && !m_fixedSize.empty())
|
if (m_isCrop && side == 1 && !m_fixedSize.empty())
|
||||||
if (std::abs(m_fixedSize.width - dst.cols) > 50 || std::abs(m_fixedSize.height - dst.rows) > 50)
|
if (std::abs(m_fixedSize.width - dst.cols) > 50 || std::abs(m_fixedSize.height - dst.rows) > 50)
|
||||||
{
|
{
|
||||||
pDib = dst.clone();
|
pDib = dst.clone();
|
||||||
#ifdef LOG
|
#ifdef LOG
|
||||||
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply");
|
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply");
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
pDib = cv::Mat(m_fixedSize, dst.type(), m_isFillBlank ? cv::Scalar(255, 255, 255) : cv::Scalar(0, 0, 0));
|
pDib = cv::Mat(m_fixedSize, dst.type(), m_isFillBlank ? cv::Scalar(255, 255, 255) : cv::Scalar(0, 0, 0));
|
||||||
|
|
||||||
cv::Rect roi;
|
cv::Rect roi;
|
||||||
|
@ -151,18 +150,20 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
||||||
roi.y = dst.rows > pDib.rows ? (dst.rows - pDib.rows) / 2 : 0;
|
roi.y = dst.rows > pDib.rows ? (dst.rows - pDib.rows) / 2 : 0;
|
||||||
roi.height = cv::min(pDib.rows, dst.rows);
|
roi.height = cv::min(pDib.rows, dst.rows);
|
||||||
cv::Rect rect((pDib.cols - roi.width) / 2, (pDib.rows - roi.height) / 2, roi.width, roi.height);
|
cv::Rect rect((pDib.cols - roi.width) / 2, (pDib.rows - roi.height) / 2, roi.width, roi.height);
|
||||||
|
|
||||||
|
for (cv::Point& p : m_maxContour)
|
||||||
|
p += roi.tl();
|
||||||
#if 0
|
#if 0
|
||||||
std::string outrectinfo ="copy to rect x: "+std::to_string(rect.x) + "y: "+std::to_string(rect.y) + "width: "+std::to_string(rect.width) + "height: "+std::to_string(rect.height);
|
std::string outrectinfo = "copy to rect x: " + std::to_string(rect.x) + "y: " + std::to_string(rect.y) + "width: " + std::to_string(rect.width) + "height: " + std::to_string(rect.height);
|
||||||
std::string outroiinfo = "roi x: " + std::to_string(roi.x) + "y: " + std::to_string(roi.y) + "width: " + std::to_string(roi.width) + "height: " + std::to_string(roi.height);
|
std::string outroiinfo = "roi x: " + std::to_string(roi.x) + "y: " + std::to_string(roi.y) + "width: " + std::to_string(roi.width) + "height: " + std::to_string(roi.height);
|
||||||
std::string dstsize = "dst size: width:" + std::to_string(dst.cols) + "height: " + std::to_string(dst.rows);
|
std::string dstsize = "dst size: width:" + std::to_string(dst.cols) + "height: " + std::to_string(dst.rows);
|
||||||
std::string pDibszie= "pDib size: width: " + std::to_string(pDib.cols) + "height: " + std::to_string(pDib.rows);
|
std::string pDibszie = "pDib size: width: " + std::to_string(pDib.cols) + "height: " + std::to_string(pDib.rows);
|
||||||
FileTools::write_log("imgprc.txt", dstsize);
|
FileTools::write_log("imgprc.txt", dstsize);
|
||||||
FileTools::write_log("imgprc.txt", pDibszie);
|
FileTools::write_log("imgprc.txt", pDibszie);
|
||||||
FileTools::write_log("imgprc.txt", outrectinfo);
|
FileTools::write_log("imgprc.txt", outrectinfo);
|
||||||
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
|
||||||
|
@ -175,23 +176,18 @@ void CImageApplyAutoCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||||
if (mats.empty()) return;
|
if (mats.empty()) return;
|
||||||
if (!mats[0].empty()) {
|
if (!mats[0].empty()) {
|
||||||
apply(mats[0], 0);
|
apply(mats[0], 0);
|
||||||
//cv::imwrite("1.bmp", mats[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isTwoSide && mats.size() > 1)
|
if (isTwoSide && mats.size() > 1)
|
||||||
{
|
{
|
||||||
cv::Size dSize = m_fixedSize;
|
cv::Size dSize = m_fixedSize;
|
||||||
if (!mats[0].empty())
|
if (!mats[0].empty())
|
||||||
m_fixedSize = mats[0].size();
|
m_fixedSize = mats[0].size();
|
||||||
|
|
||||||
if (!mats[1].empty()) {
|
if (!mats[1].empty()) {
|
||||||
apply(mats[1], 1);
|
apply(mats[1], 1);
|
||||||
//cv::imwrite("1.bmp", mats[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!mats[0].empty())
|
if (!mats[0].empty())
|
||||||
m_fixedSize = dSize;
|
m_fixedSize = dSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,41 @@
|
||||||
|
/*
|
||||||
|
* ====================================================
|
||||||
|
|
||||||
|
* 功能:自动裁剪、纠偏、除黑底
|
||||||
|
* 作者:刘丁维
|
||||||
|
* 生成时间:2020/4/21
|
||||||
|
* 最近修改时间:2020/4/21 v1.0
|
||||||
|
2020/7/22 v1.1 增加获取图像有效区域轮廓的接口maxContour(用于配合一体机的“跳过空白页”算法,PC端暂时无需使用)
|
||||||
|
2020/10/16 v1.2 修复自动裁剪尺寸精度丢失的BUG;提高除黑底缩进精度。
|
||||||
|
2020/10/28 v1.2.1 修复凹凸多边形填充背景的逻辑BUG。
|
||||||
|
2020/10/28 v1.2.2 修复图像处理必定会缩小尺寸的BUG。
|
||||||
|
2020/10/29 v1.2.3 避免无谓的纠偏(0°纠偏)。
|
||||||
|
2020/11/09 v1.2.4 避免无谓的处理(裁剪、纠偏、除黑底均为false)
|
||||||
|
* 版本号:v1.2.4
|
||||||
|
|
||||||
|
* ====================================================
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef IMAGE_APPLY_AUTO_CROP_H
|
#ifndef IMAGE_APPLY_AUTO_CROP_H
|
||||||
#define IMAGE_APPLY_AUTO_CROP_H
|
#define IMAGE_APPLY_AUTO_CROP_H
|
||||||
|
|
||||||
#include "ImageApply.h"
|
#include "ImageApply.h"
|
||||||
|
|
||||||
class CImageApplyAutoCrop : public CImageApply
|
class CImageApplyAutoCrop : public CImageApply
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CImageApplyAutoCrop();
|
CImageApplyAutoCrop();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* isCrop [in]:自动幅面裁剪使能,true自动裁剪,false为固定裁剪
|
||||||
|
* isDesaskew [in]:自动纠偏使能,true自动纠偏,false为不纠偏
|
||||||
|
* isFillBlank [in]:黑底填充使能,true为填充,false为不填充
|
||||||
|
* fixedSize [in]:固定幅面尺寸,当isCrop为false时生效,结果尺寸按fixedSize大小输出,单位像素
|
||||||
|
* isConvex [in]:黑底填充时的填充方式,true为凸多边形填充,false为凹多边形填充,默认true
|
||||||
|
* threshold [in]:二值化阈值,取值范围(0, 255),默认40
|
||||||
|
* noise [in]:除噪像素,能够消除noise宽度的背景竖条纹干扰,默认40
|
||||||
|
* indent [in]:轮廓缩进,裁剪、纠偏或者黑底填充时,对探索到的纸张轮廓进行缩进indent像素,默认5
|
||||||
|
*/
|
||||||
CImageApplyAutoCrop(bool isCrop, bool isDesaskew, bool isFillBlank, const cv::Size& fixedSize, bool isConvex = true, double threshold = 40, int noise = 40, int indent = 5);
|
CImageApplyAutoCrop(bool isCrop, bool isDesaskew, bool isFillBlank, const cv::Size& fixedSize, bool isConvex = true, double threshold = 40, int noise = 40, int indent = 5);
|
||||||
|
|
||||||
virtual ~CImageApplyAutoCrop();
|
virtual ~CImageApplyAutoCrop();
|
||||||
|
@ -64,5 +92,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !IMAGE_APPLY_AUTO_CROP_H
|
#endif // !IMAGE_APPLY_AUTO_CROP_H
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,10 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side)
|
||||||
int* idata2 = integ.ptr<int>(j + halfSize + 1);
|
int* idata2 = integ.ptr<int>(j + halfSize + 1);
|
||||||
for (int i = halfSize; i < integ.cols - halfSize - 1; i++)
|
for (int i = halfSize; i < integ.cols - halfSize - 1; i++)
|
||||||
{
|
{
|
||||||
if (data[i] < low) data[i] = 0;
|
if (data[i] < low)
|
||||||
else if (data[i] > up) data[i] = 255;
|
data[i] = 0;
|
||||||
|
else if (data[i] > up)
|
||||||
|
data[i] = 255;
|
||||||
else
|
else
|
||||||
data[i] = data[i] < ((idata2[i + halfSize + 1] - idata2[i - halfSize] - idata1[i + halfSize + 1] + idata1[i - halfSize]) / square_blockSize - threshold) ? 0 : 255;
|
data[i] = data[i] < ((idata2[i + halfSize + 1] - idata2[i - halfSize] - idata1[i + halfSize + 1] + idata1[i - halfSize]) / square_blockSize - threshold) ? 0 : 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
class CImageApplyDetachNoise : public CImageApply
|
class CImageApplyDetachNoise : public CImageApply
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CImageApplyDetachNoise(int noise = 4);
|
CImageApplyDetachNoise(int noise = 1);
|
||||||
|
|
||||||
inline int getNoise() { return m_noise; }
|
inline int getNoise() { return m_noise; }
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ cv::Mat CImageApplyDiscardBlank::getRoiMat(const cv::Mat& image)
|
||||||
processRectR(image, rect, contour, scale, thresh, blobSize);
|
processRectR(image, rect, contour, scale, thresh, blobSize);
|
||||||
cv::Rect rect2 = rect.boundingRect();
|
cv::Rect rect2 = rect.boundingRect();
|
||||||
cv::Rect inRect = rect2 & cv::Rect(0, 0, image.cols, image.rows);
|
cv::Rect inRect = rect2 & cv::Rect(0, 0, image.cols, image.rows);
|
||||||
gap = cv::max(inRect.width - rect.size.width, inRect.height - rect.size.height) + 100;
|
gap = cv::max(inRect.width - rect.size.width, inRect.height - rect.size.height) + 20;
|
||||||
inRect = cv::Rect(inRect.x + gap, inRect.y + gap, inRect.width - gap * 2, inRect.height - gap * 2);
|
inRect = cv::Rect(inRect.x + gap, inRect.y + gap, inRect.width - gap * 2, inRect.height - gap * 2);
|
||||||
return image(inRect);
|
return image(inRect);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,6 @@
|
||||||
#include "ImageApplySharpen.h"
|
#include "ImageApplySharpen.h"
|
||||||
#include "ImageApplyConcatenation.h"
|
#include "ImageApplyConcatenation.h"
|
||||||
#include "ImageApplyHSVCorrect.h"
|
#include "ImageApplyHSVCorrect.h"
|
||||||
|
#include "ImageApplyDetachNoise.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,8 +104,16 @@ void CImageApplyRotation::apply(cv::Mat & pDib, int side)
|
||||||
{
|
{
|
||||||
if (m_rotation == RotationType::Rotate_90_clockwise || m_rotation == RotationType::Rotate_90_anti_clockwise) //90<39><30> -90<39><30>
|
if (m_rotation == RotationType::Rotate_90_clockwise || m_rotation == RotationType::Rotate_90_anti_clockwise) //90<39><30> -90<39><30>
|
||||||
{
|
{
|
||||||
transpose(pDib, pDib);
|
if (side == 0)
|
||||||
flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 1 : 0);
|
{
|
||||||
|
transpose(pDib, pDib);
|
||||||
|
flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 1 : 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transpose(pDib, pDib);
|
||||||
|
flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 0 : 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_rotation == RotationType::Rotate_180)
|
else if (m_rotation == RotationType::Rotate_180)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "huagaods.hpp"
|
#include "huagaods.hpp"
|
||||||
#include "twglue.hpp"
|
#include "twglue.hpp"
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "CTwainUI.h"
|
#include "CTwainUI.h"
|
||||||
#include "CIndicatorDlg.h"
|
#include "CIndicatorDlg.h"
|
||||||
|
@ -44,7 +42,13 @@ enum class CapTypeEx : unsigned short {
|
||||||
TwEx_UVModel = 0x8093,
|
TwEx_UVModel = 0x8093,
|
||||||
TwEx_SwitchFrontBack = 0x8094,
|
TwEx_SwitchFrontBack = 0x8094,
|
||||||
TwEx_HsvCorrect = 0x8095,
|
TwEx_HsvCorrect = 0x8095,
|
||||||
TwEx_DogEarDelection=0x8096,
|
TwEx_DogEarDelection = 0x8096,
|
||||||
|
TwEx_FillBacngroundMode = 0x8097,
|
||||||
|
TwEx_CroporDesaskewIndent = 0x8098,
|
||||||
|
TwEx_CropNoise=0x8099,
|
||||||
|
TwEx_CroporDesaskewThreshold=0x8100,
|
||||||
|
TwEx_IDetachNoise = 0x8101,
|
||||||
|
TwEx_IDetachNoiseValue = 0x8102,
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace Twpp;
|
using namespace Twpp;
|
||||||
|
@ -89,7 +93,12 @@ static constexpr const Identity srcIdent(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(G400) // G200
|
#elif defined(G400) // G200
|
||||||
"G400 Series",
|
#ifdef LANXUM
|
||||||
|
"G4260F Series",
|
||||||
|
#else // ISG100
|
||||||
|
"G400 Series",
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef G200
|
#ifdef G200
|
||||||
|
@ -115,10 +124,12 @@ static constexpr const Identity srcIdent(
|
||||||
"ZhibenScan G300 TWAIN"
|
"ZhibenScan G300 TWAIN"
|
||||||
#endif
|
#endif
|
||||||
#elif defined(G400) // G200
|
#elif defined(G400) // G200
|
||||||
#ifndef MAKEHUAGAO
|
#ifdef MAKEHUAGAO
|
||||||
"ZhibenScan G400 TWAIN"
|
|
||||||
#else // !MAKEHUAGAO
|
|
||||||
"HUAGOSCAN G400 TWAIN"
|
"HUAGOSCAN G400 TWAIN"
|
||||||
|
#elif defined LANXUM //!LANXUM
|
||||||
|
"LANXUM G52XXF TWAIN"
|
||||||
|
#else // !MAKEHUAGAO
|
||||||
|
"ZhibenScan G400 TWAIN"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -136,7 +147,13 @@ static constexpr UInt32 RESOLUTIONX = 85;
|
||||||
|
|
||||||
//static std::unique_ptr<CWinApp> application(new CWinApp());
|
//static std::unique_ptr<CWinApp> application(new CWinApp());
|
||||||
|
|
||||||
|
#ifdef LANXUM
|
||||||
|
static list<float> resList = { 100.0,150.0,200.0,240.0,300.0 };
|
||||||
|
#else
|
||||||
static list<float> resList = { 100.0,150.0,200.0,240.0,300.0,600.0 };
|
static list<float> resList = { 100.0,150.0,200.0,240.0,300.0,600.0 };
|
||||||
|
#endif // LANXUM
|
||||||
|
|
||||||
|
|
||||||
//区分G200 G300、G400纸张幅面
|
//区分G200 G300、G400纸张幅面
|
||||||
#ifdef G200
|
#ifdef G200
|
||||||
|
|
||||||
|
@ -152,7 +169,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,
|
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)PaperSize::None,(UInt16)PaperSize::UsStatement };
|
(UInt16)PaperSize::None };
|
||||||
#endif // G200
|
#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 };
|
||||||
|
|
||||||
|
@ -235,6 +252,7 @@ const Identity& HuagaoDs::defaultIdentity() noexcept {
|
||||||
Result HuagaoDs::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, void* data) {
|
Result HuagaoDs::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, void* data) {
|
||||||
try {
|
try {
|
||||||
// we can override almost anything from SourceFromThis, even the top-most source instance call
|
// we can override almost anything from SourceFromThis, even the top-most source instance call
|
||||||
|
//FileTools::write_log("D:\\1.txt", "call:datagroup-"+to_string((int)dg)+"dat-"+to_string(int(dat))+"msg-"+to_string(int(msg)));
|
||||||
return Base::call(origin, dg, dat, msg, data);
|
return Base::call(origin, dg, dat, msg, data);
|
||||||
}
|
}
|
||||||
catch (const CapabilityException&) {
|
catch (const CapabilityException&) {
|
||||||
|
@ -444,9 +462,13 @@ Result HuagaoDs::eventProcess(const Identity&, Event& event) {
|
||||||
if (guiTwain) {
|
if (guiTwain) {
|
||||||
// // QApplication::processEvents(); - TODO: needs more investigation; results in freeze when attempting to scan using old DSM
|
// // QApplication::processEvents(); - TODO: needs more investigation; results in freeze when attempting to scan using old DSM
|
||||||
// QApplication::sendPostedEvents();
|
// QApplication::sendPostedEvents();
|
||||||
|
//guiTwain->PostMessageW((UINT)(event.message()));
|
||||||
guiTwain->SendMessage((UINT)(event.message()));
|
guiTwain->SendMessage((UINT)(event.message()));
|
||||||
}
|
}
|
||||||
event.setMessage(Msg::Null);
|
//if (inState(DsState::XferReady))
|
||||||
|
// event.setMessage(Msg::XferReady);
|
||||||
|
//else
|
||||||
|
event.setMessage(Msg::Null);
|
||||||
|
|
||||||
return { ReturnCode::NotDsEvent, ConditionCode::Success };
|
return { ReturnCode::NotDsEvent, ConditionCode::Success };
|
||||||
}
|
}
|
||||||
|
@ -850,10 +872,15 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data = Capability::createEnumeration(data.type(), { (UInt16)PaperSize::A3,(UInt16)PaperSize::A4,(UInt16)PaperSize::A5,(UInt16)PaperSize::A6,
|
data = Capability::createEnumeration(data.type(), { (UInt16)PaperSize::A3,(UInt16)PaperSize::A4,(UInt16)PaperSize::A5,(UInt16)PaperSize::A6,
|
||||||
(UInt16)PaperSize::IsoB5,(UInt16)PaperSize::IsoB6,(UInt16)PaperSize::UsLetter,(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::None
|
(UInt16)PaperSize::IsoB5,(UInt16)PaperSize::IsoB6,(UInt16)PaperSize::UsLetter,
|
||||||
|
(UInt16)PaperSize::UsLegal,(UInt16)PaperSize::None
|
||||||
#ifndef G300
|
#ifndef G300
|
||||||
|
#if define G200
|
||||||
,(UInt16)PaperSize::UsLedger,(UInt16)PaperSize::IsoB4,
|
,(UInt16)PaperSize::UsLedger,(UInt16)PaperSize::IsoB4,
|
||||||
(UInt16)PaperSize::MaxSize,(UInt16)PaperSize::UsStatement
|
(UInt16)PaperSize::MaxSize,(UInt16)PaperSize::UsStatement
|
||||||
|
#elif define G400
|
||||||
|
,(UInt16)PaperSize::UsLedger,(UInt16)PaperSize::IsoB4
|
||||||
|
#endif
|
||||||
#endif //
|
#endif //
|
||||||
},
|
},
|
||||||
index == -1 ? 0 : index,
|
index == -1 ? 0 : index,
|
||||||
|
@ -1051,7 +1078,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case Msg::Get:
|
case Msg::Get:
|
||||||
data = Capability::createEnumeration<CapType::Indicators>(
|
data = Capability::createEnumeration<CapType::Indicators>(
|
||||||
{ Bool(), Bool(true) }, Bool(m_bIndicator));
|
{ Bool(true), Bool(false) }, Bool(m_bIndicator),true);
|
||||||
return success();
|
return success();
|
||||||
|
|
||||||
// fallthrough
|
// fallthrough
|
||||||
|
@ -1612,7 +1639,111 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
return capBadOperation();
|
return capBadOperation();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//裁剪纠偏轮廓缩进像素
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg) {
|
||||||
|
case Msg::Get:
|
||||||
|
data = Capability::createEnumeration<UInt8>((CapType)(CapTypeEx::TwEx_CroporDesaskewIndent), m_scanparam->indent);
|
||||||
|
return success();
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<UInt8>((CapType)(CapTypeEx::TwEx_CroporDesaskewIndent), m_scanparam->indent);
|
||||||
|
return success();
|
||||||
|
case Msg::Reset:
|
||||||
|
case Msg::GetDefault:
|
||||||
|
m_scanparam->indent = 5;
|
||||||
|
data = Capability::createOneValue<UInt8>((CapType)(CapTypeEx::TwEx_CroporDesaskewIndent), UInt8(5));
|
||||||
|
return success();
|
||||||
|
case Msg::Set: {
|
||||||
|
auto mech = data.currentItem<UInt8>();
|
||||||
|
|
||||||
|
if (mech > 30 || mech < 5)
|
||||||
|
return badValue();
|
||||||
|
m_scanparam->indent = mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//自动裁剪降噪像素
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_CropNoise)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_CropNoise)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg) {
|
||||||
|
case Msg::Get:
|
||||||
|
data = Capability::createEnumeration<UInt8>((CapType)(CapTypeEx::TwEx_CropNoise), m_scanparam->noise);
|
||||||
|
return success();
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<UInt8>((CapType)(CapTypeEx::TwEx_CropNoise), m_scanparam->noise);
|
||||||
|
return success();
|
||||||
|
case Msg::Reset:
|
||||||
|
case Msg::GetDefault:
|
||||||
|
m_scanparam->noise = 40;
|
||||||
|
data = Capability::createOneValue<UInt8>((CapType)(CapTypeEx::TwEx_CropNoise), UInt8(40));
|
||||||
|
return success();
|
||||||
|
case Msg::Set: {
|
||||||
|
auto mech = data.currentItem<UInt8>();
|
||||||
|
|
||||||
|
if (mech > 50 || mech < 30)
|
||||||
|
return badValue();
|
||||||
|
m_scanparam->noise = mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//自动裁切和纠偏的二值化阀值
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg) {
|
||||||
|
case Msg::Get:
|
||||||
|
data = Capability::createEnumeration<UInt8>((CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold), m_scanparam->AutoCrop_threshold);
|
||||||
|
return success();
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<UInt8>((CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold), m_scanparam->AutoCrop_threshold);
|
||||||
|
return success();
|
||||||
|
case Msg::Reset:
|
||||||
|
case Msg::GetDefault:
|
||||||
|
m_scanparam->AutoCrop_threshold = 40;
|
||||||
|
data = Capability::createOneValue<UInt8>((CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold), UInt8(40));
|
||||||
|
return success();
|
||||||
|
case Msg::Set: {
|
||||||
|
auto mech = data.currentItem<UInt8>();
|
||||||
|
|
||||||
|
if (mech > 50 || mech < 30)
|
||||||
|
return badValue();
|
||||||
|
m_scanparam->AutoCrop_threshold = mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//黑框填充方式
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_FillBacngroundMode)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_FillBacngroundMode)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg) {
|
||||||
|
case Msg::Get:
|
||||||
|
data = Capability::createEnumeration<Bool>((CapType)(CapTypeEx::TwEx_FillBacngroundMode), { Bool(),Bool(true) }, Bool(m_scanparam->is_convex), true);
|
||||||
|
return success();
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_FillBacngroundMode), m_scanparam->is_convex);
|
||||||
|
return success();
|
||||||
|
case Msg::GetDefault:
|
||||||
|
case Msg::Reset:
|
||||||
|
m_scanparam->is_convex = true;
|
||||||
|
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_FillBacngroundMode), Bool(true));
|
||||||
|
return success();
|
||||||
|
case Msg::Set: {
|
||||||
|
auto mech = data.currentItem<Bool>();
|
||||||
|
m_scanparam->is_convex = mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
//填穿孔
|
//填穿孔
|
||||||
m_query[(CapType)(CapTypeEx::TwEx_IFillHole)] = msgSupportGetAllSetReset;
|
m_query[(CapType)(CapTypeEx::TwEx_IFillHole)] = msgSupportGetAllSetReset;
|
||||||
m_caps[(CapType)(CapTypeEx::TwEx_IFillHole)] = [this](Msg msg, Capability& data)->Result {
|
m_caps[(CapType)(CapTypeEx::TwEx_IFillHole)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
@ -1665,6 +1796,63 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//噪点优化
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_IDetachNoise)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_IDetachNoise)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg) {
|
||||||
|
case Msg::Get:
|
||||||
|
data = Capability::createEnumeration<Bool>((CapType)(CapTypeEx::TwEx_IDetachNoise), { Bool(),Bool(true) }, Bool(m_scanparam->fillhole.is_fillhole), 0);
|
||||||
|
return success();
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_IDetachNoise), m_scanparam->detachnoise.is_detachnoise);
|
||||||
|
return success();
|
||||||
|
case Msg::GetDefault:
|
||||||
|
case Msg::Reset:
|
||||||
|
m_scanparam->detachnoise.is_detachnoise = false;
|
||||||
|
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_IDetachNoise), Bool(false));
|
||||||
|
return success();
|
||||||
|
case Msg::Set: {
|
||||||
|
if (m_scanparam->pixtype != 0)
|
||||||
|
return badValue();
|
||||||
|
auto mech = data.currentItem<Bool>();
|
||||||
|
m_scanparam->detachnoise.is_detachnoise = mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
m_query[(CapType)(CapTypeEx::TwEx_IDetachNoiseValue)] = msgSupportGetAllSetReset;
|
||||||
|
m_caps[(CapType)(CapTypeEx::TwEx_IDetachNoiseValue)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
switch (msg) {
|
||||||
|
case Msg::Get:
|
||||||
|
data = Capability::createOneValue<Int32>((CapType)(CapTypeEx::TwEx_IDetachNoiseValue), m_scanparam->detachnoise.detachnoise);
|
||||||
|
return success();
|
||||||
|
case Msg::GetCurrent:
|
||||||
|
data = Capability::createOneValue<Int32>((CapType)(CapTypeEx::TwEx_IDetachNoiseValue), m_scanparam->detachnoise.detachnoise);
|
||||||
|
return success();
|
||||||
|
case Msg::GetDefault:
|
||||||
|
case Msg::Reset:
|
||||||
|
m_scanparam->fillhole.fillholeratio = 10;
|
||||||
|
data = Capability::createOneValue<Int32>((CapType)(CapTypeEx::TwEx_IDetachNoiseValue), Int32(3));
|
||||||
|
return success();
|
||||||
|
case Msg::Set: {
|
||||||
|
if (m_scanparam->detachnoise.is_detachnoise)
|
||||||
|
{
|
||||||
|
auto mech = data.currentItem<Int32>();
|
||||||
|
if (mech > 9 && mech < 51) {
|
||||||
|
m_scanparam->detachnoise.detachnoise = (int)mech;
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return badValue();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return capBadOperation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//多流除红
|
//多流除红
|
||||||
m_query[(CapType)(CapTypeEx::TwEx_IMultiOutputRed)] = msgSupportGetAllSetReset;
|
m_query[(CapType)(CapTypeEx::TwEx_IMultiOutputRed)] = msgSupportGetAllSetReset;
|
||||||
m_caps[(CapType)(CapTypeEx::TwEx_IMultiOutputRed)] = [this](Msg msg, Capability& data)->Result {
|
m_caps[(CapType)(CapTypeEx::TwEx_IMultiOutputRed)] = [this](Msg msg, Capability& data)->Result {
|
||||||
|
@ -2189,6 +2377,24 @@ Result HuagaoDs::userInterfaceEnable(const Identity&, UserInterface& ui) {
|
||||||
m_pendingXfers = 1;
|
m_pendingXfers = 1;
|
||||||
m_memXferYOff = 0;
|
m_memXferYOff = 0;
|
||||||
scanner->ResetMsgFiter();
|
scanner->ResetMsgFiter();
|
||||||
|
|
||||||
|
//if (m_capXferMech == Twpp::XferMech::Native)
|
||||||
|
//{
|
||||||
|
// MessageBox(NULL, TEXT("Native"), _T("bb"), MB_OK);
|
||||||
|
//}
|
||||||
|
//else if (m_capXferMech == Twpp::XferMech::File)
|
||||||
|
//{
|
||||||
|
// MessageBox(NULL, TEXT("File"), _T("bb"), MB_OK);
|
||||||
|
|
||||||
|
//}
|
||||||
|
//else if (m_capXferMech == Twpp::XferMech::Memory)
|
||||||
|
//{
|
||||||
|
// MessageBox(NULL, TEXT("Memory"), _T("bb"), MB_OK);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// MessageBox(NULL, TEXT("MemoryFile"), _T("bb"), MB_OK);
|
||||||
|
//}
|
||||||
if (!ui.showUi()) {
|
if (!ui.showUi()) {
|
||||||
// this is an exception when we want to set state explicitly, notifyXferReady can be called only in enabled state
|
// this is an exception when we want to set state explicitly, notifyXferReady can be called only in enabled state
|
||||||
// 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
|
||||||
|
@ -2196,16 +2402,16 @@ Result HuagaoDs::userInterfaceEnable(const Identity&, UserInterface& ui) {
|
||||||
auto ret = startScan();
|
auto ret = startScan();
|
||||||
if (ret.status().condition() == Twpp::CC::NoMedia)
|
if (ret.status().condition() == Twpp::CC::NoMedia)
|
||||||
return ret;
|
return ret;
|
||||||
//if (ret == success()) {
|
if (ret == success()) {
|
||||||
//m_pendingXfers = 1;
|
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);
|
||||||
|
@ -2368,11 +2574,9 @@ Result HuagaoDs::imageNativeXferGet(const Identity& id, ImageNativeXfer& data) {
|
||||||
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>);
|
bmpData.reset(new std::vector<unsigned char>);
|
||||||
#ifdef LOG_NORMAL
|
|
||||||
|
|
||||||
#endif // LOG
|
|
||||||
//std::string info = "Twain transfered num of " + to_string(++xtfer)+" images";
|
//std::string info = "Twain transfered num of " + to_string(++xtfer)+" images";
|
||||||
//FileTools::write_log("D:\\1.txt", info);
|
FileTools::write_log("Twain transfered num of " + to_string(++xtfer) + " images");
|
||||||
return { ReturnCode::XferDone, ConditionCode::Success };
|
return { ReturnCode::XferDone, ConditionCode::Success };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2386,7 +2590,6 @@ Twpp::Result HuagaoDs::pendingXfersStopFeeder(const Identity& origin, PendingXfe
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setCount(scanner->Get_IsImageQueueEmpty() ? 0 : 1);
|
data.setCount(scanner->Get_IsImageQueueEmpty() ? 0 : 1);
|
||||||
//FileTools::write_log("D:\\1.txt", "pendingXfersStopFeeder exit");
|
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2613,7 +2816,49 @@ Twpp::Result HuagaoDs::startScan()
|
||||||
}
|
}
|
||||||
|
|
||||||
scanner->ResetScanner();
|
scanner->ResetScanner();
|
||||||
|
std::string info = "\n m_scanparam->is_autocrop :" + to_string(m_scanparam->is_autocrop);
|
||||||
|
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);
|
||||||
|
FileTools::write_log(info);
|
||||||
#ifndef G200
|
#ifndef G200
|
||||||
scanner->clear_hwerror();
|
scanner->clear_hwerror();
|
||||||
#endif //
|
#endif //
|
||||||
|
|
Binary file not shown.
Binary file not shown.
BIN
huagao/stdafx.h
BIN
huagao/stdafx.h
Binary file not shown.
Loading…
Reference in New Issue