twain2/gscn_drv.cpp

59 lines
915 B
C++

#include "stdafx.h"
#include "gscn_drv.h"
#include "stdio.h"
#include "turbojpeg.h"
#include <map>
#include "twainEx.h"
#include "jpeglib.h"
#include "ImageApply.h"
#include "hugaotwainds.h"
#include "filetools.h"
#include "UsbScanEx.h"
#include "opencv2/opencv.hpp"
extern ChugaotwaindsApp theApp;
GScn_Drv::GScn_Drv() :pixType(TJPF_BGR)
{
devState = DEV_STOP;
Error_Code = 0;
}
GScn_Drv::~GScn_Drv()
{
}
void DoEvents()
{
MSG msg;
if (PeekMessage(&msg , NULL, 0, 0, PM_REMOVE)) {
DispatchMessage(&msg);
TranslateMessage(&msg);
}
}
cv::Mat GScn_Drv::popMat()
{
std::lock_guard<std::mutex> lck(m_imgLocker);
cv::Mat image = m_pImages.popMat();
return image;
}
void GScn_Drv::pushMat(JpegBuffer& data)
{
m_pImages.pushMat(data);
}
void GScn_Drv::trim(std::string &s)
{
int index = 0;
if (!s.empty())
{
while ((index = s.find(' ', index)) != string::npos)
{
s.erase(index, 1);
}
}
}