1)增加G300 G400型号

2)针对vs2019编译xp增加命令行/Zc:threadSafeInit- 关闭静态对象线程安全初始化功能
3)增加无纸提示
This commit is contained in:
masayume 2021-01-16 14:56:46 +08:00
parent 2446e4b33d
commit 4f8de560eb
18 changed files with 197 additions and 51 deletions

View File

@ -46,7 +46,7 @@ BOOL AboutHuaGoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
if(scanName == "Hi-5100")
if(scanName == "Hi-5100"|| scanName == "G300" || scanName == "G400" )
{
m_bitmap.LoadBitmap(IDB_BMPABOUTDLG);
}

Binary file not shown.

View File

@ -492,13 +492,21 @@ static void initialDictionary()
dpiDct.insert(pair<pair<TwSS,float>,CSize>(pair<TwSS,float>(USLegal, 600), CSize(5100, 8400) ));
}
static CSize getSize(TwSS paperType, float dpi)
static CSize getSize(TwSS paperType, float dpi,int orentation=0)
{
CSize retSize;
map<pair<TwSS, float>, CSize>::iterator iter;
iter = dpiDct.find(pair<TwSS, float>(paperType,dpi));
if(iter != dpiDct.end()){
retSize = (*iter).second;
if(orentation==0)
retSize = (*iter).second;
else
{
CSize size;
size.cx = iter->second.cy;
size.cy = iter->second.cx;
return size;
}
return retSize;
}
return CSize(2338, 3307);
@ -522,7 +530,15 @@ CScanner_FreeImage::CScanner_FreeImage() :
// set default caps
resetScanner();
InitMSGMap();
#ifdef G300
g_drv.open(0x3072, 0x300);
#elif defined G400
g_drv.open(0x3072, 0x400);
#else
g_drv.open(0x064B, 0x7823);
#endif // G300
}
//////////////////////////////////////////////////////////////////////////////
@ -598,6 +614,7 @@ bool CScanner_FreeImage::acquireImage(bool bscan)
hgConfigClass cf;
cf.setDoubleFeedEnable(m_HardWareParams.DoubleFeederOn);
cf.setResolution(200.0);
#ifdef G200
cf.setSkewDelection(m_HardWareParams.SkrewDetectOn);
switch (m_HardWareParams.SkrewDetectLevel)
{
@ -629,11 +646,23 @@ bool CScanner_FreeImage::acquireImage(bool bscan)
default:
break;
}
#endif // G200
g_drv.ResetScanner();//初始化DSP状态
cf.setStapleEnable(m_HardWareParams.StapleDetectOn);
cf.setTwPixelType(m_HardWareParams.PixType);
cf.settwSS(m_HardWareParams.PaperType);
#ifndef G200
#ifdef G300
cf.setDstHeight_G400((getSize(TwSS::A4, 200.0f, m_wRotation).cy + 200) / 100);
#else
cf.setDstHeight_G400((getSize((TwSS)m_HardWareParams.PaperType, m_HardWareParams.Resolution,m_wRotation).cy+200)/100);
#endif // G300
cf.setReversed_G400(0, 0);
cf.setIsCorrect_G400(true);
#endif // !G200
UINT32 cfg_Value =cf.GetData();
//cfg_Value = 9307488;
USBCB usbcb = { CONFIGURED_DATA , cfg_Value,0 };
g_drv.set_decompress_pix_type(m_HardWareParams.PixType);
g_drv.Config_Scanner(&usbcb);

View File

@ -103,8 +103,17 @@ TW_IDENTITY CTWAINDS_Base::m_TheIdentity =
#ifdef __APPLE__
"\p"
#endif
//"HuaGoScan Hi-5100 TWAIN" // TW_STR32 ProductName; Product name, e.g. "ScanJet Plus"
"ZhibenScan XS8100 TWAIN"
#ifdef G200
"HuaGoScan Hi-5100 TWAIN" // TW_STR32 ProductName; Product name, e.g. "ScanJet Plus"
#elif defined G300
"HuaGoScan G300 TWAIN"
#elif defined G400
"HuaGoScan G400 TWAIN"
//"ZhibenScan XS8100 TWAIN"
#endif // G200
};
//////////////////////////////////////////////////////////////////////////////
@ -444,10 +453,12 @@ TW_INT16 CTWAINDS_FreeImage::Initialize()
|| !pnCap->Add(0x8092)//去除穿孔所占幅面占比
//硬件协议
#ifdef G200
|| !pnCap->Add(0x8006)//歪斜检测
|| !pnCap->Add(0x8021)//歪斜程度
|| !pnCap->Add(CAP_DOUBLEFEEDDETECTION)//双张检测
|| !pnCap->Add(0x8090)//装订检测
#endif // G200
|| !pnCap->Add(CAP_DOUBLEFEEDDETECTION)//双张检测
|| !pnCap->Add(0x8091)//自动丢弃空白页(发票)
)
@ -575,6 +586,7 @@ TW_INT16 CTWAINDS_FreeImage::Initialize()
//文稿类型
m_IndependantCapMap[ICAP_SUPPORTEDSIZES] = new CTWAINContainerInt(ICAP_SUPPORTEDSIZES, TWTY_UINT16, TWON_ENUMERATION);
if (NULL == (pnCap = dynamic_cast<CTWAINContainerInt*>(m_IndependantCapMap[ICAP_SUPPORTEDSIZES]))
#ifdef G200
|| !pnCap->Add(TWSS_NONE)
|| !pnCap->Add(TWSS_A3)
|| !pnCap->Add(TWSS_A4, true)
@ -592,7 +604,36 @@ TW_INT16 CTWAINDS_FreeImage::Initialize()
|| !pnCap->Add(80)//LETTER横向
|| !pnCap->Add(81)//Double LetterR
|| !pnCap->Add(TWSS_USLEGAL)
|| !pnCap->Add(TWSS_MAXSIZE))//长文稿
|| !pnCap->Add(TWSS_MAXSIZE)//长文稿
#elif defined G300
|| !pnCap->Add(TWSS_NONE)
|| !pnCap->Add(TWSS_A4, true)
|| !pnCap->Add(TWSS_A5)
|| !pnCap->Add(TWSS_A6)
|| !pnCap->Add(2)//B5
|| !pnCap->Add(TWSS_B6)//B6
|| !pnCap->Add(TWSS_USLETTER)
|| !pnCap->Add(TWSS_USLEGAL)
#elif defined G400
|| !pnCap->Add(TWSS_NONE)
|| !pnCap->Add(TWSS_A3)
|| !pnCap->Add(TWSS_A4, true)
|| !pnCap->Add(60)//A4R
|| !pnCap->Add(TWSS_A5)
|| !pnCap->Add(61)//A5R
|| !pnCap->Add(TWSS_A6)
|| !pnCap->Add(62)//A6R
|| !pnCap->Add(TWSS_B4)
|| !pnCap->Add(2)//B5
|| !pnCap->Add(70)//B5R
|| !pnCap->Add(TWSS_B6)//B6
|| !pnCap->Add(71)//B6横向
|| !pnCap->Add(TWSS_USLETTER)
|| !pnCap->Add(80)//LETTER横向
|| !pnCap->Add(81)//Double LetterR
|| !pnCap->Add(TWSS_USLEGAL)
#endif // G200
)
{
cerr << "Could not create ICAP_SUPPORTEDSIZES" << endl;
setConditionCode(TWCC_LOWMEMORY);
@ -1068,6 +1109,9 @@ TW_INT16 CTWAINDS_FreeImage::Initialize()
setConditionCode(TWCC_LOWMEMORY);
return TWRC_FAILURE;
}
#ifdef G200
//歪斜检测
m_IndependantCapMap[0x8006] = new CTWAINContainerBool(0x8006, TWON_ONEVALUE, TWQC_ALL);
@ -1093,6 +1137,17 @@ TW_INT16 CTWAINDS_FreeImage::Initialize()
return TWRC_FAILURE;
}
//装订检测
m_IndependantCapMap[0x8090] = new CTWAINContainerBool(0x8090, TWON_ONEVALUE, TWQC_ALL);
if (NULL == (pbCap = dynamic_cast<CTWAINContainerBool*>(m_IndependantCapMap[0x8090]))
|| !pbCap->Add(TRUE)
|| !pbCap->Add(FALSE, true))
{
cerr << "Could not create Double Feeded DETECT" << endl;
setConditionCode(TWCC_LOWMEMORY);
return TWRC_FAILURE;
}
#endif // G200
//双张检测
m_IndependantCapMap[CAP_DOUBLEFEEDDETECTION] = new CTWAINContainerBool(CAP_DOUBLEFEEDDETECTION, (m_AppID.SupportedGroups & DF_APP2) != 0, TWQC_ALL);
if (NULL == (pbCap = dynamic_cast<CTWAINContainerBool*>(m_IndependantCapMap[CAP_DOUBLEFEEDDETECTION]))
@ -1104,16 +1159,6 @@ TW_INT16 CTWAINDS_FreeImage::Initialize()
return TWRC_FAILURE;
}
//装订检测
m_IndependantCapMap[0x8090] = new CTWAINContainerBool(0x8090, TWON_ONEVALUE, TWQC_ALL);
if (NULL == (pbCap = dynamic_cast<CTWAINContainerBool*>(m_IndependantCapMap[0x8090]))
|| !pbCap->Add(TRUE)
|| !pbCap->Add(FALSE, true))
{
cerr << "Could not create Double Feeded DETECT" << endl;
setConditionCode(TWCC_LOWMEMORY);
return TWRC_FAILURE;
}
//多流除红
m_IndependantCapMap[0x8026] = new CTWAINContainerBool(0x8026, TWON_ONEVALUE, TWQC_ALL);
@ -2011,7 +2056,7 @@ bool CTWAINDS_FreeImage::UpdateCapsFromConfig(CONFIGPARAMS pConfig)
{
bret = pbCap->SetCurrent(pConfig.EnUltrasonicDetect);
}
#ifdef G200
//歪斜检测等级
if (0 == (pfRCap = dynamic_cast<CTWAINContainerFix32Range*>(findCapability(0x8021))))
{
@ -2034,6 +2079,9 @@ bool CTWAINDS_FreeImage::UpdateCapsFromConfig(CONFIGPARAMS pConfig)
bret = pbCap->SetCurrent(pConfig.EnBindingDetect);
}
#endif // G200
//扫描张数
if (0 == (pnCap = dynamic_cast<CTWAINContainerInt*>(findCapability(CAP_XFERCOUNT))))
{
@ -2338,6 +2386,9 @@ bool CTWAINDS_FreeImage::updateScannerFromCaps()
bret = pbCap->GetCurrent(bVal);
settings->m_bBackRotate180 = bVal;
}
#ifdef G200
if (0 == (pbCap = dynamic_cast<CTWAINContainerBool*>(findCapability(0x8006))))//歪斜检测
{
@ -2372,7 +2423,7 @@ bool CTWAINDS_FreeImage::updateScannerFromCaps()
bret = pbCap->GetCurrent(bVal);
settings->m_HardWareParams.StapleDetectOn = bVal;
}
#endif // G200
if (0 == (pnCap = dynamic_cast<CTWAINContainerInt*>(findCapability(CAP_XFERCOUNT))))
{
//XdPrint("updateScannerFromCaps CAP_XFERCOUNT Error");
@ -2382,8 +2433,12 @@ bool CTWAINDS_FreeImage::updateScannerFromCaps()
bret = pnCap->GetCurrent(nVal);
m_Xfers.Count = nVal;
bool bVal = settings->m_bDuplex;
if (bVal){
if (nVal % 2 == 1)
nVal += 1;
}
//settings->m_wScanCount = 0;
settings->m_wScanCount = bVal ? nVal / 2 : nVal;
nVal == -1 ? settings->m_wScanCount = -1:(settings->m_wScanCount = (bVal ? nVal / 2 : nVal));
//XdPrint("updateScannerFromCaps CAP_XFERCOUNT :%d \n", settings->m_wScanCount);
}
@ -2843,6 +2898,13 @@ TW_INT16 CTWAINDS_FreeImage::validateCapabilitySet(TW_UINT16 _Cap, TW_UINT16 _C
bool CTWAINDS_FreeImage::StartScanning(bool showUI)
{
while (!m_Scanner.isPaperOn())
{
std::string text = StringToUtf("检测到无纸,请添加纸张");
std::string op = StringToUtf("提示");
if (MessageBoxA(NULL,text.c_str(), op.c_str(), MB_YESNO | MB_SYSTEMMODAL) == IDNO)
return false();
}
// Update the scanner with the latest negotiated caps
if (!updateScannerFromCaps())
{

Binary file not shown.

View File

@ -32,7 +32,7 @@ void ImageMatQueue::setmultioutputR(bool canoutput/*=false*/)
ImageMatQueue::~ImageMatQueue(void)
{
bRun = false;
this_thread::sleep_for(chrono::milliseconds(100));
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
}
void ImageMatQueue::pushMat(JpegBuffer& data)
@ -90,7 +90,7 @@ void ImageMatQueue::proc()
{
while (bRun)
{
this_thread::sleep_for(chrono::milliseconds(5));
boost::this_thread::sleep_for(boost::chrono::milliseconds(5));
{
if (m_images.empty() && !m_pImages.empty())
{
@ -108,8 +108,8 @@ void ImageMatQueue::proc()
{
#ifdef LOG
CString csImageA, csImageB;
csImageA.Format("d:\\orig\\%d.jpg", (++iii));
csImageB.Format("d:\\orig\\%d.jpg", (++iii));
csImageA.Format("D:\\%d.jpg", (++iii));
csImageB.Format("D:\\%d.jpg", (++iii));
IplImage qqImgA, qqImgB;
qqImgA = IplImage(mats[0]); // cv::Mat -> IplImage

View File

@ -61,7 +61,14 @@ std::vector<cv::Mat> JpegBuffer::getMats(int pixType)
JpegLib jl;
for (size_t i = 0; i < m_buffer.size(); i++)
{
#ifndef G200
cv::Mat mat = cv::imdecode(m_buffer[i], pixType == TJPF_BGR ? 1 : 0);
cv::Mat front = mat(cv::Rect(0, 0, mat.cols / 2, mat.rows));
cv::Mat back = mat(cv::Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows));
return { front,back };
#else
rets.push_back(jl.decode(m_buffer[i], pixType).clone());
#endif
}
return rets;

View File

@ -210,7 +210,11 @@ CONFIGPARAMS JsonConfig::GetDefaultConfigParams()
{
CONFIGPARAMS params;
params.Pixtype=1;//灰度
params.PaperSize=11;//A3
#ifdef G300
params.PaperSize = 1;//A4
#else
params.PaperSize = 11;//A3
#endif // G300
params.EnAutoCrop=FALSE;//自动裁切
params.Resolution=200;//200dpi
params.Duplex=1;//双面

Binary file not shown.

Binary file not shown.

View File

@ -25,7 +25,7 @@ GScn_Drv::~GScn_Drv()
if (m_threadUsb.joinable())
{
m_bRun = false;
this_thread::sleep_for(chrono::milliseconds(300));
boost::this_thread::sleep_for(boost::chrono::milliseconds(300));
}
}
@ -63,7 +63,7 @@ int GScn_Drv::aquire_image(cv::Mat& image)
{
if (Get_IsImageQueueEmpty())
{
this_thread::sleep_for(chrono::milliseconds(1));
boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
if(sw.time_run() > 20.00)
{
if (m_threadUsb.joinable())
@ -92,7 +92,7 @@ int GScn_Drv::aquire_image(cv::Mat& image)
image = popMat();
return 0;
}
this_thread::sleep_for(chrono::milliseconds(2));//¼õÉÙCPU¿ªÏú
boost::this_thread::sleep_for(boost::chrono::milliseconds(2));//¼õÉÙCPU¿ªÏú
}
}
}
@ -100,7 +100,10 @@ int GScn_Drv::aquire_image(cv::Mat& image)
void GScn_Drv::reset()
{
while (!m_pImages.empty())
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
m_pImages.clear();
}
}
void GScn_Drv::pushMat(JpegBuffer& data)
@ -173,7 +176,7 @@ DWORD GScn_Drv::usbmain()
{
if (!m_usb->is_connected())
{
this_thread::sleep_for(chrono::milliseconds(200));
boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
continue;
}
USBCB usbcb = Get_Scanner_Status();
@ -186,6 +189,7 @@ DWORD GScn_Drv::usbmain()
vector<Mat> mats;
imgData = Get_Img_Data(totalNum);
#ifdef G200
bufferF = Mat(imgData.rows,imgData.cols,CV_8UC1);
bufferB = Mat(imgData.rows,imgData.cols,CV_8UC1);
int j = 0;
@ -205,13 +209,15 @@ DWORD GScn_Drv::usbmain()
}
mats.push_back(bufferB);
mats.push_back(bufferF);
#else
mats.push_back(imgData);
#endif // G200
pushMat(JpegBuffer(mats, pixType,0));
mats.clear();
imgData.release();
bufferB.release();
bufferF.release();
Pop_Image();
break;
}
@ -240,7 +246,7 @@ DWORD GScn_Drv::usbmain()
default:
break;
}
this_thread::sleep_for(chrono::milliseconds(20));
boost::this_thread::sleep_for(boost::chrono::milliseconds(20));
}
return 0;
}
@ -280,10 +286,16 @@ std::string GScn_Drv::GetFWVersion()
{
boost::lock_guard<boost::mutex> lck(m_imgLocker);
std::string pFWVersion = " ";
USBCB usbcb = { GET_FW_VERSION,8,0 };
#ifndef G200
pFWVersion.resize(10);
#else
pFWVersion.reserve(8);
#endif // G200
USBCB usbcb = { GET_FW_VERSION,pFWVersion.size(),0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
m_usb->read_bulk(&pFWVersion[0], 8);
m_usb->read_bulk(&pFWVersion[0], pFWVersion.size());
return pFWVersion;
}
return "";
@ -296,10 +308,15 @@ std::string GScn_Drv::GetSerialNum()
{
boost::lock_guard<boost::mutex> lck(m_imgLocker);
std::string pserialNum = " ";
USBCB usbcb = { GET_SERIAL,12,0 };
#ifndef G200
pserialNum.resize(14);
#else
pserialNum.reserve(12);
#endif // G200
USBCB usbcb = { GET_SERIAL,pserialNum.size(),0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
m_usb->read_bulk(&pserialNum[0], 12);
m_usb->read_bulk(&pserialNum[0], pserialNum.size());
return pserialNum;
}
return "";

Binary file not shown.

View File

@ -23,13 +23,13 @@
<ProjectGuid>{F928F998-CD13-478E-8D23-5943C2B108F5}</ProjectGuid>
<Keyword>MFCDLLProj</Keyword>
<RootNamespace>hugaotwainds</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
<WholeProgramOptimization>false</WholeProgramOptimization>
@ -37,7 +37,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
@ -79,8 +79,8 @@
<LinkIncremental>true</LinkIncremental>
<TargetExt>.ds</TargetExt>
<OutDir>C:\Windows\twain_32\ZhibenScan</OutDir>
<IncludePath>.\pub\json;.\pub;D:\local\boost_1_69_0;$(IncludePath)</IncludePath>
<LibraryPath>D:\local\boost_1_69_0\lib32-msvc-10.0;.\pub\external\lib;$(LibraryPath)</LibraryPath>
<IncludePath>D:\local\boost_1_75_0;$(IncludePath)</IncludePath>
<LibraryPath>D:\local\boost_1_75_0\lib32-msvc-14.2;.\pub\external\lib;$(LibraryPath)</LibraryPath>
<ReferencePath>$(ReferencePath)</ReferencePath>
<ExecutablePath>.\pub\json;.\pub;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
@ -93,10 +93,10 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>C:\Windows\twain_32\ZhibenScan</OutDir>
<OutDir>..\..\..\..\..\Windows\twain_32\HuagaoT</OutDir>
<TargetExt>.ds</TargetExt>
<IncludePath>D:\local\boost_1_69_0;$(IncludePath)</IncludePath>
<LibraryPath>D:\local\boost_1_69_0\lib32-msvc-10.0;$(LibraryPath)</LibraryPath>
<IncludePath>D:\local\boost_1_75_0;$(IncludePath)</IncludePath>
<LibraryPath>D:\local\boost_1_75_0\lib32-msvc-14.2;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
@ -111,6 +111,7 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;HW_VER;HUAGAO_VER;_CRT_SECURE_NO_WARNINGS;LOG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\pub\json;.\pub\opencv\include;.\pub\ddk;.\3rdparty\nick;.\3rdparty\turbojpeg\include;.\3rdparty\hgOCR\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -167,6 +168,7 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;HW_VER;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\pub\json;.\pub\opencv\include;.\pub\ddk;.\3rdparty\nick;.\3rdparty\turbojpeg\include;.\3rdparty\hgOCR\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>D:\华高科技\xnviewer\xnview.exe</LocalDebuggerCommand>
<LocalDebuggerCommand>C:\Program Files %28x86%29\TWAIN Working Group\TWAIN 2.3 App Sample\TWAIN_App_mfc32.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>C:\Windows\twain_32\ZhibenScan</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
@ -12,8 +12,8 @@
<DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>C:\Program Files (x86)\ZHIBENSCAN\ZhibenScan.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>C:\Windows\twain_32\ZhibenScan</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommand>C:\Program Files %28x86%29\TWAIN Working Group\TWAIN 2.3 App Sample\TWAIN_App_mfc32.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>..\..\..\..\..\Windows\twain_32\HuagaoT</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

View File

@ -23,14 +23,15 @@ cv::Mat JpegLib::decode(cv::Mat& buf, int pixelFormat)
{
if(buf.rows != 1)
return cv::Mat();
decode(buf.data, buf.cols, pixelFormat);
return cv::Mat(getHeight(), getWidth(), pixelFormat == TJPF_BGR ? CV_8UC3 : CV_8UC1, getData());
return cv::Mat(getHeight(), getWidth() , pixelFormat == TJPF_BGR ? CV_8UC3 : CV_8UC1, getData());
}
void JpegLib::decode(unsigned char* buff, unsigned long buff_size, int pixelFormat)
{
tjDecompressHeader(handle.get(), buff, buff_size, &width, &height);
int size = width * height *tjPixelSize[pixelFormat];

View File

@ -7,9 +7,11 @@ typedef unsigned short uint16_t;
hgConfigClass::hgConfigClass()
{
m_data.reset();
initpaperTypes();
initPixType();
initResolution();
}
@ -90,6 +92,25 @@ void hgConfigClass::setSkewLevel2bit(bool value)
setBit(14, value);
}
void hgConfigClass::setReversed_G400(UINT16 one, UINT16 two)
{
for (int i = 0; i < 6; i++)
m_data.set(11 + i, one & (1 << i));
for (int i = 0; i < 6; i++)
m_data.set(26 + i, one & (1 << i));
}
void hgConfigClass::setIsCorrect_G400(bool value)
{
m_data.set(17, value);
}
void hgConfigClass::setDstHeight_G400(UINT16 value)
{
for (int i = 0; i < 8; i++)
m_data.set(18 + i, value & (1 << i));
}
UINT32 hgConfigClass::GetData()
{
return m_data.to_ulong();

View File

@ -6,6 +6,7 @@
#include <bitset>
#include "PublicFunc.h"
class hgConfigClass
{
public:
@ -22,6 +23,9 @@ public:
void setSkewLevel0bit(bool value);
void setSkewLevel1bit(bool value);
void setSkewLevel2bit(bool value);
void setReversed_G400(UINT16 one, UINT16 two);
void setIsCorrect_G400(bool value);
void setDstHeight_G400(UINT16 value);
UINT32 GetData();
private:
enum Config_Scanner
@ -43,7 +47,6 @@ private:
bool ContainsResolutionKey(float key);
void setBit(int i, bool flag);
std::bitset<32> m_data;
};

Binary file not shown.