mirror of http://192.168.1.51:8099/lmh188/twain3.0
1.调整huagaods.cpp 文件中值协议类型;
2.调整Gscan 虚函数部分代码; 3.调整UV部分处理逻辑以适配这个版本处理流程; 4.调整仿射变换插值方式为线性邻域插值,避免锯齿出现; 5.去除图像处理中log宏定义; 6.修改进度指示器中扫描页数以及上传张数单位
This commit is contained in:
parent
97522c024b
commit
cfe838b394
|
@ -48,7 +48,7 @@ END_MESSAGE_MAP()
|
|||
void CIndicatorDlg::setindicatortext(int aquire, int updata)
|
||||
{
|
||||
wchar_t text[260] = { 0 };
|
||||
_stprintf(text, L"扫描\t\t\t\t%d\n上传\t\t\t\t%d", aquire,updata);
|
||||
_stprintf(text, L"扫描\t\t\t\t%d 页\n上传\t\t\t\t%d 面", aquire,updata);
|
||||
GetDlgItem(IDC_STATIC)->SetWindowTextW(text);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
#include "filetools.h"
|
||||
|
@ -124,19 +127,63 @@ class IScanner
|
|||
{
|
||||
public:
|
||||
IScanner() {
|
||||
bFilterMsg = false; aquire_image_count = updata_image_count = updata_image_count = roller_num = lose_image_num = 0; is_AndroidOrLinux = false;
|
||||
imgreadednum = imgtransfered = roller_num = lose_image_num = 0;
|
||||
is_AndroidOrLinux = false;
|
||||
}
|
||||
virtual ~IScanner()
|
||||
{
|
||||
bFilterMsg = true;
|
||||
}
|
||||
void ResetMsgFiter() { bFilterMsg = true; }
|
||||
int get_aquire_image_count() { return aquire_image_count; };
|
||||
int get_updata_image_count() { return updata_image_count; };
|
||||
|
||||
/// <summary>
|
||||
/// 获取PC获取的图像数量(页计数)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int get_imgnReaded() { return imgreadednum; };
|
||||
/// <summary>
|
||||
/// 获取图像传输张数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int get_imgTransfered() { return imgtransfered; };
|
||||
/// <summary>
|
||||
/// 获取丢失图像张数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int get_lose_image_num() { return lose_image_num; };
|
||||
/// <summary>
|
||||
/// 设置丢失图像张数
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
void set_lose_image_num(int value) { lose_image_num = value; };
|
||||
void set_aquire_image_count(int aquire, int updata) { aquire_image_count = aquire; updata_image_count = updata; if (setindicatortext) setindicatortext(aquire, updata); };
|
||||
void regist_indicatortext_callback(std::function<void(int, int)> indicatortext) { if (indicatortext) setindicatortext = indicatortext; };
|
||||
/// <summary>
|
||||
/// 获取原始图像计数自加一
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int countNReaded()
|
||||
{
|
||||
return ++imgreadednum;
|
||||
};
|
||||
/// <summary>
|
||||
/// 已处理图像传输数量自加一
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int countNTransfered()
|
||||
{
|
||||
return ++imgtransfered;
|
||||
};
|
||||
|
||||
void UpdateScanInfo(int aquire, int updata)
|
||||
{
|
||||
imgreadednum = aquire;
|
||||
imgtransfered = updata;
|
||||
if (setindicatortext)
|
||||
setindicatortext(aquire, updata);
|
||||
};
|
||||
|
||||
void regist_indicatortext_callback(std::function<void(int, int)> indicatortext)
|
||||
{
|
||||
if (indicatortext)
|
||||
setindicatortext = indicatortext;
|
||||
};
|
||||
virtual void open(int vid, int pid) = 0;
|
||||
virtual void regist_deviceevent_callback(deviceevent_callback callback, void* usrdata = 0) = 0;
|
||||
virtual void DogEar_callback(std::function<void(int)> fun)=0;
|
||||
|
@ -171,8 +218,8 @@ public:
|
|||
}
|
||||
}
|
||||
protected:
|
||||
volatile UINT32 Error_Code;
|
||||
volatile int devState;
|
||||
atomic_uint32_t Error_Code;
|
||||
atomic_int devState;
|
||||
std::shared_ptr<ImageMatQueue> m_pImages;
|
||||
std::mutex m_Locker;
|
||||
std::mutex m_imgLocker;
|
||||
|
@ -182,12 +229,10 @@ protected:
|
|||
std::uint32_t MotorFpga;
|
||||
std::uint32_t ScanFpga;
|
||||
std::function<void(int, int)> setindicatortext;
|
||||
int aquire_image_count;
|
||||
int updata_image_count;
|
||||
int imgreadednum;
|
||||
int imgtransfered;
|
||||
int roller_num;
|
||||
int pixType;
|
||||
int lose_image_num;
|
||||
bool bFilterMsg;
|
||||
bool is_AndroidOrLinux;
|
||||
|
||||
};
|
|
@ -149,7 +149,7 @@ GScanO200::GScanO200() :
|
|||
is_orginimgcount(true)
|
||||
{
|
||||
m_pImages.reset(new ImageMatQueue());
|
||||
auto getimgnum = [&](bool isadd)
|
||||
auto getimgnum = [&](bool isadd,int num)
|
||||
{
|
||||
isadd ? image_num++ : image_num--;
|
||||
};
|
||||
|
@ -200,10 +200,7 @@ void GScanO200::regist_deviceevent_callback(deviceevent_callback callback, void*
|
|||
huagods = usrdata;
|
||||
dev_callback = callback;
|
||||
}
|
||||
#ifdef LOG_NORMAL
|
||||
fstream fsaquire;
|
||||
static int aquiretimes = 1;
|
||||
#endif // LOG
|
||||
|
||||
int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
||||
{
|
||||
StopWatch sw;
|
||||
|
@ -223,8 +220,8 @@ int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
|||
Stop_scan();//ֹͣɨÃè
|
||||
ResetScanner();
|
||||
auto rollernew = Get_Roller_num();
|
||||
if (get_aquire_image_count() != (rollernew - roller_num))
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_aquire_image_count()));
|
||||
if (get_imgnReaded() != (rollernew - roller_num))
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_imgnReaded()));
|
||||
return HARDWARE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -238,15 +235,7 @@ int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
|||
else {
|
||||
if (m_pImages->valid()) {
|
||||
bmpdata = *(m_pImages->popBmpdata());
|
||||
//static int aqimgindex = 0;
|
||||
//writelog("aquireed image " + to_string(++aqimgindex));
|
||||
//FileTools::write_log("C:\\Users\\huagao\\Desktop\\out.txt", "aquired procced image "+ to_string(++aqimgindex));
|
||||
|
||||
set_aquire_image_count(get_aquire_image_count(), get_updata_image_count() + 1);
|
||||
#ifdef LOG_NORMAL
|
||||
static int aquireindex = 0;
|
||||
FileTools::write_log("out.txt", "aquire image index " + std::to_string(++aquireindex));
|
||||
#endif // LOG
|
||||
UpdateScanInfo(get_imgnReaded(), countNTransfered());
|
||||
return 0;
|
||||
}
|
||||
DoEvents();
|
||||
|
@ -616,21 +605,6 @@ void GScanO200::usbmain()
|
|||
FileTools::writelog(log_ERROR, "USBmain aquire image timeout");
|
||||
return;
|
||||
}
|
||||
//if(gcap.resolution_dst>200.0f)
|
||||
//{
|
||||
// if (m_pImages->orginimgcount() > 2)
|
||||
// {
|
||||
// this_thread::sleep_for(chrono::milliseconds(10));
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
//else {
|
||||
// if ((m_pImages->orginimgcount() > 15)&&(is_orginimgcount))
|
||||
// {
|
||||
// this_thread::sleep_for(chrono::milliseconds(10));
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
|
||||
USBCB usbcb = Get_Scanner_Status();
|
||||
switch (usbcb.u32_Data) {
|
||||
|
@ -648,8 +622,8 @@ void GScanO200::usbmain()
|
|||
if(!m_pImages->get_isDogEar())
|
||||
m_pImages->pushMat(std::shared_ptr<IDecode>(new G200Decode(imgData)));
|
||||
Pop_Image();
|
||||
set_aquire_image_count(get_aquire_image_count() + 1,get_updata_image_count());
|
||||
FileTools::writelog(log_INFO, "´ÓɨÃèÒǽÓÊÕ"+to_string(get_aquire_image_count())+"·ÝÎļþ¡£");
|
||||
UpdateScanInfo(countNReaded(), get_imgTransfered());
|
||||
FileTools::writelog(log_INFO, "´ÓɨÃèÒǽÓÊÕ"+to_string(get_imgnReaded())+"·ÝÎļþ¡£");
|
||||
sw.reset();
|
||||
break;
|
||||
}
|
||||
|
@ -658,10 +632,10 @@ void GScanO200::usbmain()
|
|||
m_pImages->setscanflags(false);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||
auto rollernew= Get_Roller_num();
|
||||
if (get_aquire_image_count() != (rollernew - roller_num))
|
||||
if (get_imgnReaded() != (rollernew - roller_num))
|
||||
{
|
||||
Set_ErrorCode(LOSE_IMAGE);
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_aquire_image_count()));
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_imgnReaded()));
|
||||
haveError = true;
|
||||
}
|
||||
devState = haveError ? DevState::DEV_WRONG : DevState::DEV_STOP;
|
||||
|
@ -689,8 +663,8 @@ void GScanO200::usbmain()
|
|||
devState = DEV_WRONG;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||
auto rollernew = Get_Roller_num();
|
||||
if (get_aquire_image_count() != (rollernew - roller_num))
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_aquire_image_count()));
|
||||
if (get_imgnReaded() != (rollernew - roller_num))
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_imgnReaded()));
|
||||
if (huagods)
|
||||
dev_callback(usbcb.u32_Data, huagods);
|
||||
break;
|
||||
|
@ -723,11 +697,6 @@ USBCB GScanO200::Get_Scanner_Status()
|
|||
|
||||
if (m_usb.get() && m_usb->is_connected())
|
||||
m_usb->read_bulk(&usbcb, sizeof(usbcb));
|
||||
//if (usbcb.u32_CMD != GET_DSP_STATUS)
|
||||
//{
|
||||
// FileTools::writelog(log_ERROR, "get dsp status usb bulk error");
|
||||
// return { NO_COMMAND,USB_BULK_ERROR,0 };
|
||||
//}
|
||||
return usbcb;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ GScanO400::GScanO400() :
|
|||
m_bread_fixed_ratio_fromDSP(false)
|
||||
{
|
||||
m_pImages.reset(new ImageMatQueue());
|
||||
auto getimgnum = [&](bool isadd)
|
||||
auto getimgnum = [&](bool isadd,int num)
|
||||
{
|
||||
isadd ? image_num++ : image_num--;
|
||||
isadd ? image_num+=num : image_num-=num;
|
||||
};
|
||||
m_pImages->SetGetimgnumcall(getimgnum);
|
||||
}
|
||||
|
@ -170,22 +170,9 @@ GScanO400::~GScanO400()
|
|||
|
||||
}
|
||||
|
||||
|
||||
void GScanO400::Getimagenumber(bool isadd)
|
||||
{
|
||||
if (isadd)
|
||||
{
|
||||
image_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
image_num--;
|
||||
}
|
||||
}
|
||||
|
||||
void GScanO400::DogEar_callback(std::function<void(int)> fun)
|
||||
{
|
||||
m_pImages->SetGetimgnumcall(fun);
|
||||
m_pImages->SetDogEarCallback(fun);
|
||||
}
|
||||
|
||||
void GScanO400::open(int vid, int pid)
|
||||
|
@ -214,10 +201,7 @@ void GScanO400::regist_deviceevent_callback(deviceevent_callback callback, void*
|
|||
huagods = usrdata;
|
||||
dev_callback = callback;
|
||||
}
|
||||
#ifdef LOG_NORMAL
|
||||
fstream fsaquire;
|
||||
static int aquiretimes = 1;
|
||||
#endif // LOG
|
||||
|
||||
int GScanO400::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
||||
{
|
||||
StopWatch sw;
|
||||
|
@ -249,7 +233,7 @@ int GScanO400::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
|
|||
else {
|
||||
if (m_pImages->valid()) {
|
||||
bmpdata = *(m_pImages->popBmpdata());
|
||||
set_aquire_image_count(get_aquire_image_count(), get_updata_image_count() + 1);
|
||||
UpdateScanInfo(get_imgnReaded(), countNTransfered());
|
||||
return 0;
|
||||
}
|
||||
DoEvents();
|
||||
|
@ -428,6 +412,7 @@ void GScanO400::Scanner_StartScan(UINT16 count)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int readlenght = 0;
|
||||
USBCB paperstatus = { GET_PAPER_STATUS ,0,0 };
|
||||
if (m_usb.get() && m_usb->is_connected())
|
||||
|
@ -617,6 +602,10 @@ void GScanO400::updateHVRatio()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef UV
|
||||
static int indeximg = 0;
|
||||
#endif
|
||||
|
||||
void GScanO400::usbmain()
|
||||
{
|
||||
std::shared_ptr<std::vector<char>> imgData;
|
||||
|
@ -641,27 +630,12 @@ void GScanO400::usbmain()
|
|||
FileTools::writelog(log_ERROR, "USBmain aquire image timeout");
|
||||
return;
|
||||
}
|
||||
//if(gcap.resolution_dst>200.0f)
|
||||
//{
|
||||
// if (m_pImages->orginimgcount() > 2)
|
||||
// {
|
||||
// this_thread::sleep_for(chrono::milliseconds(10));
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
//else {
|
||||
// if (m_pImages->orginimgcount() > 10) {
|
||||
// this_thread::sleep_for(chrono::milliseconds(10));
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
|
||||
USBCB usbcb = Get_Scanner_Status();
|
||||
switch (usbcb.u32_Data) {
|
||||
case HAVE_IMAGE:
|
||||
{
|
||||
int totalNum = usbcb.u32_Count;
|
||||
//if(is_AndroidOrLinux)
|
||||
// m_usb->read_bulk(error_buf->data(), 512);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
m_usb->set_timeout(2000);
|
||||
imgData = Get_Img_Data(totalNum);
|
||||
|
@ -679,10 +653,26 @@ void GScanO400::usbmain()
|
|||
if(!m_pImages->get_isDogEar())
|
||||
m_pImages->pushMat(std::shared_ptr<IDecode>(new G400Decode(imgData)));
|
||||
|
||||
set_aquire_image_count(get_aquire_image_count() + 1,get_updata_image_count());
|
||||
#ifdef UV
|
||||
if(gcap.hardwarecaps.en_uv)
|
||||
{
|
||||
if(indeximg%2==0)
|
||||
{
|
||||
UpdateScanInfo(countNReaded(), get_imgTransfered());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateScanInfo(countNReaded(), get_imgTransfered());
|
||||
}
|
||||
indeximg++;
|
||||
#else
|
||||
UpdateScanInfo(countNReaded(), get_imgTransfered());
|
||||
#endif
|
||||
|
||||
if(!is_AndroidOrLinux)
|
||||
Pop_Image();
|
||||
FileTools::writelog(log_INFO, "从扫描仪接收" + to_string(get_aquire_image_count()) + "份文件。耗时 "+to_string(sw.elapsed_ms()));
|
||||
FileTools::writelog(log_INFO, "从扫描仪接收" + to_string(get_imgnReaded()) + "份文件。耗时 "+to_string(sw.elapsed_ms()));
|
||||
sw.reset();
|
||||
break;
|
||||
}
|
||||
|
@ -691,16 +681,13 @@ void GScanO400::usbmain()
|
|||
m_pImages->setscanflags(false);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||
auto rollernew = Get_Roller_num();
|
||||
if (get_aquire_image_count() != (rollernew - roller_num))
|
||||
if (get_imgnReaded() != (rollernew - roller_num))
|
||||
{
|
||||
Set_ErrorCode(LOSE_IMAGE);
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_aquire_image_count()));
|
||||
set_lose_image_num(std::abs((rollernew - roller_num) - get_imgnReaded()));
|
||||
haveError = true;
|
||||
}
|
||||
devState = haveError ? DevState::DEV_WRONG : DevState::DEV_STOP;
|
||||
|
||||
//m_pImages->setscanflags(false);
|
||||
//devState = DEV_STOP;
|
||||
break;
|
||||
}
|
||||
case COUNT_MODE:
|
||||
|
|
|
@ -93,7 +93,7 @@ void ImageMatQueue::updatefixratio(float& hratio, float& vratio)
|
|||
}
|
||||
}
|
||||
|
||||
void ImageMatQueue::SetGetimgnumcall(std::function<void(bool)> getimgnumcall)
|
||||
void ImageMatQueue::SetGetimgnumcall(std::function<void(bool,int)> getimgnumcall)
|
||||
{
|
||||
m_Getimagenumber = getimgnumcall;
|
||||
}
|
||||
|
@ -108,7 +108,18 @@ static int paperIndex = 0;
|
|||
void ImageMatQueue::pushMat(std::shared_ptr<IDecode> data)
|
||||
{
|
||||
if(m_Getimagenumber)
|
||||
m_Getimagenumber(true);
|
||||
{
|
||||
#ifdef UV
|
||||
if(scanParam.hardwarecaps.en_uv)
|
||||
m_Getimagenumber(true, 2);
|
||||
else
|
||||
m_Getimagenumber(true, 1);
|
||||
#else
|
||||
m_Getimagenumber(true, 1);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
m_rawBuffs.Put(data);
|
||||
atm_orgin_image_remains++;
|
||||
//string paperindexinfo = "Get the index of "+to_string(++paperIndex)+" Paper";
|
||||
|
@ -318,8 +329,20 @@ void ImageMatQueue::EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>>
|
|||
void ImageMatQueue::PaniusCount(int count)
|
||||
{
|
||||
atm_orgin_image_remains-=count;
|
||||
if(m_Getimagenumber)
|
||||
m_Getimagenumber(false);
|
||||
#ifdef UV
|
||||
if(scanParam.hardwarecaps.en_uv)
|
||||
{
|
||||
if(m_Getimagenumber)
|
||||
m_Getimagenumber(false, 2);
|
||||
}
|
||||
else
|
||||
if(m_Getimagenumber)
|
||||
m_Getimagenumber(false, 1);
|
||||
#else
|
||||
if (m_Getimagenumber)
|
||||
m_Getimagenumber(false,1);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ImageMatQueue::init_cachethread()
|
||||
|
@ -334,7 +357,6 @@ void ImageMatQueue::init_cachethread()
|
|||
static int index = 0;
|
||||
void ImageMatQueue::cache_run()
|
||||
{
|
||||
StopWatch sw;
|
||||
std::ios::sync_with_stdio(false);
|
||||
while(benablecache)
|
||||
{
|
||||
|
@ -352,6 +374,7 @@ void ImageMatQueue::cache_run()
|
|||
|
||||
for (auto& buf : buffs)
|
||||
{
|
||||
StopWatch sw;
|
||||
index++;
|
||||
string path = FileTools::get_appdata_path() + to_string(m_snowflake.nextid()) + ".jpg";
|
||||
|
||||
|
@ -375,13 +398,14 @@ void ImageMatQueue::cache_run()
|
|||
frb.Close();
|
||||
info.path = path;
|
||||
m_imgCacheinfo.Put(info);
|
||||
buf->clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
FileTools::writelog(log_ERROR, "error while openning cache file :" + path);
|
||||
}
|
||||
FileTools::writelog(log_INFO, " 磁盘写入图片数据耗时 " + to_string(sw.elapsed_ms()) + " buffer size = " + to_string(buf->size()));
|
||||
buf->clear();
|
||||
buf.reset();
|
||||
sw.reset();
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +435,7 @@ bool ImageMatQueue::queuesempty()
|
|||
|
||||
void ImageMatQueue::proc()
|
||||
{
|
||||
StopWatch sw;
|
||||
|
||||
while (bRun)
|
||||
{
|
||||
string msg;
|
||||
|
@ -431,6 +455,7 @@ void ImageMatQueue::proc()
|
|||
|
||||
std::vector<cv::Mat> mats;
|
||||
std::vector<Mat> uvmats;
|
||||
StopWatch sw;
|
||||
if(info.scannerType==ScannerSerial::G200Serial)
|
||||
{
|
||||
auto back= m_imgCacheinfo.Take();
|
||||
|
@ -486,6 +511,7 @@ void ImageMatQueue::proc()
|
|||
}
|
||||
mats.push_back(back);
|
||||
mats.push_back(front);
|
||||
remove(info.path.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -499,12 +525,13 @@ void ImageMatQueue::proc()
|
|||
auto matuv = imread(uvinfo.path, IMREAD_COLOR);
|
||||
if(!matuv.empty())
|
||||
{
|
||||
Mat front = mat(Rect(0, 0, mat.cols / 2, mat.rows));
|
||||
Mat back = mat(Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows));
|
||||
Mat front = matuv(Rect(0, 0, mat.cols / 2, mat.rows));
|
||||
Mat back = matuv(Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows));
|
||||
uvmats.push_back(scanParam.is_switchfrontback ? back : front);
|
||||
uvmats.push_back(scanParam.is_switchfrontback ? front : back);
|
||||
front.release();
|
||||
back.release();
|
||||
remove(uvinfo.path.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -514,6 +541,7 @@ void ImageMatQueue::proc()
|
|||
std::vector<int> angleResults;
|
||||
bool isDesaskew = false;
|
||||
|
||||
sw.reset();
|
||||
for (int j = 0; j < m_iaList.size(); j++) {
|
||||
m_iaList[j]->apply(mats, scanParam.is_duplex);
|
||||
CImageApply* ptr = m_iaList[j].get();
|
||||
|
@ -544,6 +572,7 @@ void ImageMatQueue::proc()
|
|||
#endif
|
||||
|
||||
FileTools::writelog(log_INFO, "图像处理耗时 " + to_string(sw.elapsed_ms()));
|
||||
sw.reset();
|
||||
for (int i = 0; i < mats.size(); i++) {
|
||||
if (!scanParam.is_duplex && i == 1) {
|
||||
mats[i].release();
|
||||
|
@ -567,7 +596,9 @@ void ImageMatQueue::proc()
|
|||
FileTools::writelog(log_ERROR, "enqueue image is empty " + std::to_string(index++));
|
||||
}
|
||||
}
|
||||
FileTools::writelog(log_INFO, "转码BMP 耗时: " + to_string(sw.elapsed_ms()));
|
||||
|
||||
sw.reset();
|
||||
if (scanParam.multi_output_red) {
|
||||
for (int i = 0; i < mats.size(); i++) {
|
||||
if (!mats[i].empty()) {
|
||||
|
@ -587,14 +618,15 @@ void ImageMatQueue::proc()
|
|||
}
|
||||
}
|
||||
}
|
||||
FileTools::writelog(log_INFO, "多流输出 耗时: " + to_string(sw.elapsed_ms()));
|
||||
}
|
||||
|
||||
mats.clear();
|
||||
#ifdef UV
|
||||
PaniusCount(scanParam.hardwarecaps.en_uv ? 2 : 1);
|
||||
#else
|
||||
PaniusCount();
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "ImageProcess/ImageApplyHeaders.h"
|
||||
#include "PublicFunc.h"
|
||||
|
@ -195,7 +196,7 @@ public:
|
|||
int orginimgcount();
|
||||
void setscanflags(const bool flags) { is_scanning = flags; }
|
||||
void updatefixratio(float& hratio, float& vratio);
|
||||
void SetGetimgnumcall(std::function<void(bool)> getimgnumcall);
|
||||
void SetGetimgnumcall(std::function<void(bool,int)> getimgnumcall);
|
||||
void SetDogEarCallback(std::function<void(int)> dogearcall);
|
||||
|
||||
private:
|
||||
|
@ -215,16 +216,16 @@ private:
|
|||
bool ischeck_dogear;
|
||||
volatile int DogEar_index;
|
||||
volatile bool is_DogEar;
|
||||
volatile bool bRun;
|
||||
volatile bool benablecache;
|
||||
volatile int atm_orgin_image_remains;
|
||||
volatile bool is_scanning;
|
||||
atomic_bool bRun;
|
||||
atomic_bool benablecache;
|
||||
atomic_int atm_orgin_image_remains;
|
||||
atomic_bool is_scanning;
|
||||
GScanCap scanParam;
|
||||
Device::PaperSize papersize;
|
||||
std::shared_ptr<CImageApplyDogEarDetection> m_dogear;
|
||||
std::vector<std::shared_ptr<CImageApply>> m_iaList; //ͼÏñ´¦Àíº¯Êý½Ó¿Ú
|
||||
float fx, fy;
|
||||
std::function<void(int)> m_DogEarDetection_callback;
|
||||
std::function<void(bool)> m_Getimagenumber;
|
||||
std::function<void(bool,int)> m_Getimagenumber;
|
||||
snowflake_t m_snowflake;
|
||||
};
|
|
@ -504,7 +504,7 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
|||
itmEnSwitchFrontBack.Get(i, b_value);
|
||||
cfp.is_switchfrontback = b_value ? 1 : 0;
|
||||
#ifdef UV
|
||||
root["Config"].Get(ENUVMODEL, b_value);
|
||||
itmEnUV.Get(i, b_value);
|
||||
cfp.hardwarecaps.en_uv = b_value ? 1 : 0;
|
||||
#endif
|
||||
itmBrtnes.Get(i, i_value);
|
||||
|
@ -611,15 +611,15 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
|||
cfp.is_autodiscradblank_vince = bvalue?1:0;
|
||||
root["Config"].Get(DISCARBLANK_VALUE, index);
|
||||
cfp.discardblank_percent = index ;
|
||||
//root["Config"].Get(DB_AREANUM, index);
|
||||
//cfp.DBlank_AreaNum = index;
|
||||
//root["Config"].Get(DB_DEVNMAX, index);
|
||||
//cfp.DBlank_DevnMax = index;
|
||||
|
||||
root["Config"].Get(FLOD, bvalue);
|
||||
cfp.en_fold = bvalue?1:0;
|
||||
root["Config"].Get(SWITCHFRONTBACK, bvalue);
|
||||
cfp.is_switchfrontback = bvalue?1:0;
|
||||
|
||||
#ifdef UV
|
||||
root["Config"].Get(ENUVMODEL, bvalue);
|
||||
cfp.hardwarecaps.en_uv = bvalue ? 1 : 0;
|
||||
#endif
|
||||
root["Config"].Get(BRIGHTNESS, index);
|
||||
cfp.brightness = index;
|
||||
root["Config"].Get(AUTOCONTRAST, bvalue);
|
||||
|
@ -730,6 +730,9 @@ json GscanJsonConfig::GscancapToJson(GScanCap& cap)
|
|||
js[CONFIG][DISCARBLANK_VALUE] = cap.discardblank_percent;
|
||||
js[CONFIG][FLOD] = cap.en_fold;
|
||||
js[CONFIG][SWITCHFRONTBACK] = cap.is_switchfrontback;
|
||||
#ifdef UV
|
||||
js[CONFIG][ENUVMODEL] = cap.hardwarecaps.en_uv;
|
||||
#endif
|
||||
js[CONFIG][DETACHNOISE] = cap.detachnoise.is_detachnoise;
|
||||
js[CONFIG][DETACHNOISEVALUE] = cap.detachnoise.detachnoise;
|
||||
js[CONFIG][BRIGHTNESS] = cap.brightness;
|
||||
|
@ -785,6 +788,9 @@ GScanCap GscanJsonConfig::JsonToGscancap(json& js)
|
|||
cap.discardblank_percent = json_cast(js[CONFIG][DISCARBLANK_VALUE]).to_int();
|
||||
cap.en_fold = json_cast(js[CONFIG][FLOD]).to_int();
|
||||
cap.is_switchfrontback = json_cast(js[CONFIG][SWITCHFRONTBACK]).to_int();
|
||||
#ifdef UV
|
||||
cap.hardwarecaps.en_uv = json_cast(js[CONFIG][ENUVMODEL]).to_int();
|
||||
#endif // UV
|
||||
cap.detachnoise.is_detachnoise = json_cast(js[CONFIG][DETACHNOISE]).to_int();
|
||||
cap.detachnoise.detachnoise = json_cast(js[CONFIG][DETACHNOISEVALUE]).to_int();
|
||||
cap.brightness = json_cast(js[CONFIG][BRIGHTNESS]).to_float();
|
||||
|
@ -820,6 +826,58 @@ GScanCap GscanJsonConfig::JsonToGscancap(json& js)
|
|||
}
|
||||
json GscanJsonConfig::GetDefaultJson()
|
||||
{
|
||||
#ifdef UV
|
||||
return json::parse(R"({
|
||||
"Config": {
|
||||
"iPixType": 2 ,
|
||||
"bAutoMaticColorDetece": false ,
|
||||
"iAutoMaticColorDeteceType": 1 ,
|
||||
"iPaparSize": 0 ,
|
||||
"iPaperAlign": 0 ,
|
||||
"iEnSizeCheck": false ,
|
||||
"bAuotCrop": true ,
|
||||
"iResolution": 200 ,
|
||||
"iDuplex": true ,
|
||||
"bDiscardBlank": false ,
|
||||
"bDiscardBlankVince": false ,
|
||||
"discardblank_percent": 20 ,
|
||||
"bFlod": false ,
|
||||
"bSwitchFrontBack": false ,
|
||||
"bUVmodel": false,
|
||||
"detachnoise": false ,
|
||||
"detachnoisevalue": 30 ,
|
||||
"iBrightness": 0 ,
|
||||
"bAutoContrast": false ,
|
||||
"iContrast": 0 ,
|
||||
"dGamma": 1 ,
|
||||
"iFilter": 3 ,
|
||||
"iEnhance": 0 ,
|
||||
"iSharpen": 0 ,
|
||||
"bAutoDescrew": true ,
|
||||
"bFillBlcak": true ,
|
||||
"iMultiOutPut": false ,
|
||||
"bOutHole": false ,
|
||||
"iOutHoleRatio": 10 ,
|
||||
"bHsvCorrect": false ,
|
||||
"bUltrasonicDetect": true ,
|
||||
"bBindingDetect": false ,
|
||||
"ScanCount": 65535 ,
|
||||
"bOrientation": 0 ,
|
||||
"bAutoText": false ,
|
||||
"iBackRotate180": false ,
|
||||
"dogeardetection": false ,
|
||||
"bScrewDetect": true ,
|
||||
"iScrewLevel": 3 ,
|
||||
"Noise": 8 ,
|
||||
"Indent": 5 ,
|
||||
"AutoCrop_Threshold": 40 ,
|
||||
"isConvex": true ,
|
||||
"ilowpowermode": 4,
|
||||
"Caption": "" ,
|
||||
"SavePath": ""
|
||||
}
|
||||
})");
|
||||
#else
|
||||
return json::parse(R"({
|
||||
"Config": {
|
||||
"iPixType": 2 ,
|
||||
|
@ -869,6 +927,8 @@ json GscanJsonConfig::GetDefaultJson()
|
|||
"SavePath": ""
|
||||
}
|
||||
})");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
json GscanJsonConfig::Readjson(std::string path)
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
#ifndef IMAGE_APPLY_H
|
||||
#define IMAGE_APPLY_H
|
||||
|
||||
//#define LOG
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
#if defined(LOG)
|
||||
#include "Device/filetools.h"
|
||||
#endif
|
||||
|
||||
class CImageApply
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -55,9 +55,6 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
|||
if (m_maxContour.size() == 0)
|
||||
{
|
||||
thre.release();
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
thre.release();
|
||||
|
@ -88,7 +85,7 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
|||
dstTri[2] = cv::Point2f(rect.size.width - 1, 0);
|
||||
cv::Mat warp_mat;
|
||||
warp_mat = cv::getAffineTransform(srcTri, dstTri);
|
||||
cv::warpAffine(src, dst, warp_mat, rect.size, cv::INTER_NEAREST);
|
||||
cv::warpAffine(src, dst, warp_mat, rect.size, cv::INTER_LINEAR);
|
||||
}
|
||||
else
|
||||
dst = src(boudingRect & cv::Rect(0, 0, src.cols, src.rows));
|
||||
|
@ -153,9 +150,6 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
|
|||
p += roi.tl();
|
||||
dst(roi).copyTo(pDib(rect));
|
||||
}
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply8");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageApplyAutoCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
|
|
@ -53,9 +53,6 @@ void CImageApplyChannel::apply(cv::Mat& pDib,int side)
|
|||
}
|
||||
pDib.release();
|
||||
pDib = dst;
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyChannel apply");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageApplyChannel::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
|
|
@ -11,30 +11,18 @@ CImageApplyCrop::~CImageApplyCrop(void)
|
|||
|
||||
void CImageApplyCrop::apply(cv::Mat& pDib,int side)
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "enter CImageApplyCrop apply");
|
||||
#endif // LOG
|
||||
|
||||
if (pDib.empty())
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyCrop apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_roi.x < 0 || m_roi.y < 0 || m_roi.br().x >= pDib.cols || m_roi.br().y >= pDib.rows || m_roi.width == 0 || m_roi.height == 0)
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyCrop apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
|
||||
pDib = pDib(m_roi).clone();
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyCrop apply");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageApplyCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
@ -49,4 +37,4 @@ void CImageApplyCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
|||
if (!mats[1].empty())
|
||||
apply(mats[1], 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -126,15 +126,8 @@ cv::Mat CImageApplyDiscardBlank::getRoiMat(const cv::Mat& image)
|
|||
|
||||
void CImageApplyDiscardBlank::apply(cv::Mat& pDib, int side)
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "enter CImageApplyDiscardBlank apply");
|
||||
#endif // LOG
|
||||
|
||||
if (pDib.empty())
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyDiscardBlank apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,9 +146,6 @@ void CImageApplyDiscardBlank::apply(cv::Mat& pDib, int side)
|
|||
if(!scalar_LE(dev, m_devTh))
|
||||
{
|
||||
m_res = false;
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyDiscardBlank apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -163,9 +153,6 @@ void CImageApplyDiscardBlank::apply(cv::Mat& pDib, int side)
|
|||
m_res = true;
|
||||
if (m_res)
|
||||
pDib.release();
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyDiscardBlank apply");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageApplyDiscardBlank::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#include "ImageApplyOutHole.h"
|
||||
#include "ImageProcess_Public.h"
|
||||
|
||||
#ifdef LOG
|
||||
#include "Device/filetools.h"
|
||||
#endif // LOG
|
||||
|
||||
CImageOutHole::CImageOutHole(void)
|
||||
: CImageApply()
|
||||
, m_borderSize(200)
|
||||
|
@ -33,23 +29,14 @@ void CImageOutHole::apply(cv::Mat& pDib, int side)
|
|||
|
||||
void CImageOutHole::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "enter ImageOutHole apply");
|
||||
#endif // LOG
|
||||
|
||||
if (mats.size() < 2)
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit ImageOutHole apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
|
||||
if (mats[0].empty() || mats[1].empty())
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit ImageOutHole apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -133,9 +120,6 @@ void CImageOutHole::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
|||
hg::fillPolys(temp, contours_temp, color);
|
||||
}
|
||||
}
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit ImageOutHole apply");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageOutHole::getRoi(cv::RotatedRect rrect_front, cv::RotatedRect rrect_back, cv::Size srcSize,
|
||||
|
|
|
@ -31,14 +31,8 @@ CImageApplyRotation::~CImageApplyRotation()
|
|||
void CImageApplyRotation::apply(cv::Mat& pDib, int side)
|
||||
{
|
||||
m_angleResult = 0;
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "enter CImageApplyRotation apply");
|
||||
#endif // LOG
|
||||
if (pDib.empty())
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyRotation apply");
|
||||
#endif // LOG
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,9 +116,6 @@ void CImageApplyRotation::apply(cv::Mat& pDib, int side)
|
|||
m_angleResult = 180;
|
||||
}
|
||||
}
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplyRotation apply");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageApplyRotation::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
|
|
@ -12,10 +12,6 @@ CImageApplySharpen::~CImageApplySharpen()
|
|||
|
||||
void CImageApplySharpen::apply(cv::Mat & pDib, int side)
|
||||
{
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "enter CImageApplySharpen apply");
|
||||
#endif // LOG
|
||||
|
||||
switch (sharpenType)
|
||||
{
|
||||
case CImageApplySharpen::Sharpen:
|
||||
|
@ -27,10 +23,6 @@ void CImageApplySharpen::apply(cv::Mat & pDib, int side)
|
|||
averblur(pDib, static_cast<int>(kSize));
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef LOG
|
||||
FileTools::write_log("imgprc.txt", "exit CImageApplySharpen apply");
|
||||
#endif // LOG
|
||||
}
|
||||
|
||||
void CImageApplySharpen::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
|
|
@ -145,7 +145,12 @@ static constexpr const Identity srcIdent(
|
|||
#endif
|
||||
#elif defined G300 // G200
|
||||
#ifdef MAKEHUAGAO
|
||||
#ifdef UV
|
||||
"HUAGOSCAN G300UV TWAIN"
|
||||
#else
|
||||
"HUAGOSCAN G300 TWAIN"
|
||||
#endif
|
||||
|
||||
#elif defined LANXUM //!LANXUM
|
||||
"LANXUMSCAN G42S TWAIN"
|
||||
#else // !MAKEHUAGAO
|
||||
|
@ -340,26 +345,26 @@ void HuagaoDs::showmsg(std::string caption, std::string text, int retcode)
|
|||
if (scanner.get()) {
|
||||
int losemun = scanner->get_lose_image_num();
|
||||
int num = 0;
|
||||
if ((retcode == 64 || retcode == 8 || retcode == 16) && losemun > 0)
|
||||
if ((retcode == 64 || retcode == 8 || retcode == 16) && losemun > 0)//64 ->SStop
|
||||
losemun--;
|
||||
if (!(m_scanparam->is_autodiscradblank_normal || m_scanparam->is_autodiscradblank_vince))
|
||||
{
|
||||
if (m_scanparam->is_duplex && m_scanparam->en_fold && m_scanparam->multi_output_red)
|
||||
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 2 - scanner->get_imgTransfered();
|
||||
else if (m_scanparam->is_duplex && m_scanparam->en_fold)
|
||||
num = scanner->get_aquire_image_count() - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() - scanner->get_imgTransfered();
|
||||
else if (m_scanparam->is_duplex && m_scanparam->multi_output_red)
|
||||
num = scanner->get_aquire_image_count() * 4 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 4 - scanner->get_imgTransfered();
|
||||
else if ((!m_scanparam->is_duplex) && m_scanparam->multi_output_red)
|
||||
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 2 - scanner->get_imgTransfered();
|
||||
else if (!m_scanparam->is_duplex)
|
||||
num = scanner->get_aquire_image_count() - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() - scanner->get_imgTransfered();
|
||||
else
|
||||
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 2 - scanner->get_imgTransfered();
|
||||
}
|
||||
if ((losemun != 0) || (num != 0)) {
|
||||
text += "进纸" + to_string(scanner->get_lose_image_num() + scanner->get_aquire_image_count()) +
|
||||
",扫描" + to_string(scanner->get_aquire_image_count()) + ",上传" + to_string(scanner->get_updata_image_count()) +
|
||||
text += "进纸" + to_string(scanner->get_lose_image_num() + scanner->get_imgnReaded()) +
|
||||
",扫描" + to_string(scanner->get_imgnReaded()) + ",上传" + to_string(scanner->get_imgTransfered()) +
|
||||
",扫描相差" + to_string(losemun) + "份文件,上传相差" + to_string(num) + "份文件!";
|
||||
scanner->set_lose_image_num(0);
|
||||
}
|
||||
|
@ -755,18 +760,6 @@ void HuagaoDs::SetResoluton(const char* path, int resolution)
|
|||
delete[]buf;
|
||||
}
|
||||
|
||||
void HuagaoDs::dogear_callback(int indexpaper)
|
||||
{
|
||||
CString text;
|
||||
text.Format(_T("74 %d"), indexpaper);
|
||||
//ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), text, NULL, SW_HIDE);
|
||||
showmsg("警告", "在" + to_string(indexpaper) + "检测到折角!");
|
||||
scanner->Stop_scan();
|
||||
//scanner->reset();
|
||||
scanner->ResetScanner();
|
||||
onDeviceEvent(DOG_EAR);
|
||||
}
|
||||
|
||||
|
||||
Result HuagaoDs::identityOpenDs(const Identity&) {
|
||||
hMutex = CreateMutex(NULL, FALSE, _T("LookitApp"));
|
||||
|
@ -831,7 +824,18 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
else
|
||||
{
|
||||
scanner->regist_deviceevent_callback(DeviceEvent_callback, this);
|
||||
scanner->DogEar_callback(std::bind(&HuagaoDs::dogear_callback, this, std::placeholders::_1));
|
||||
auto dgcall = [&](int pagenum)
|
||||
{
|
||||
CString text;
|
||||
text.Format(_T("74 %d"), pagenum);
|
||||
//ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), text, NULL, SW_HIDE);
|
||||
showmsg("警告", "在" + to_string(pagenum) + "检测到折角!");
|
||||
scanner->Stop_scan();
|
||||
//scanner->reset();
|
||||
scanner->ResetScanner();
|
||||
onDeviceEvent(DOG_EAR);
|
||||
};
|
||||
scanner->DogEar_callback(dgcall);
|
||||
}
|
||||
//MessageBox(NULL, L"2", L"", 0);
|
||||
// init caps
|
||||
|
@ -1283,7 +1287,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->is_switchfrontback = mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_SwitchFrontBack>(msg, data, { FALSE,TRUE }, m_scanparam->is_switchfrontback, (Bool)false, m_scanparam->is_switchfrontback ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_SwitchFrontBack>(msg, data, m_scanparam->is_switchfrontback, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_SwitchFrontBack>(msg, data, { FALSE,TRUE }, m_scanparam->is_switchfrontback, (Bool)false, m_scanparam->is_switchfrontback ? 1 : 0, 0);
|
||||
};
|
||||
|
||||
m_query[CapType::IAutomaticRotate] = msgSupportGetAllSetReset;
|
||||
|
@ -1388,7 +1393,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
}
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Int32, (CapType)CapTypeEx::TwEx_EnFold>(msg, data, { 0,1 }, m_scanparam->en_fold, 0, m_scanparam->en_fold ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Int32, (CapType)CapTypeEx::TwEx_EnFold>(msg, data, m_scanparam->en_fold, 0);
|
||||
//return CapSupGetAllResetEx<BYTE, Int32, (CapType)CapTypeEx::TwEx_EnFold>(msg, data, { 0,1 }, m_scanparam->en_fold, 0, m_scanparam->en_fold ? 1 : 0, 0);
|
||||
};
|
||||
|
||||
m_query[CapType::IAutoDiscardBlankPages] = msgSupportGetAllSetReset;
|
||||
|
@ -1435,8 +1441,9 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->is_autodiscradblank_normal = 0;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IAutoDiscardBlankVince>(msg, data, m_scanparam->is_autodiscradblank_vince, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IAutoDiscardBlankVince>(msg, data, { FALSE,TRUE }, m_scanparam->is_autodiscradblank_vince, Bool(false), m_scanparam->is_autodiscradblank_vince ? 1 : 0, 0);
|
||||
return oneValGet<Bool>(msg, data, Bool(m_scanparam->is_autodiscradblank_vince));
|
||||
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_IBackRotate180)] = msgSupportGetAllSetReset;
|
||||
|
@ -1448,7 +1455,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->is_duplex = 1;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IBackRotate180>(msg, data, { FALSE,TRUE }, m_scanparam->is_backrotate180, Bool(false), m_scanparam->is_backrotate180 ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IBackRotate180>(msg, data, m_scanparam->is_backrotate180, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IBackRotate180>(msg, data, { FALSE,TRUE }, m_scanparam->is_backrotate180, Bool(false), m_scanparam->is_backrotate180 ? 1 : 0, 0);
|
||||
};
|
||||
|
||||
//填黑框
|
||||
|
@ -1459,8 +1467,10 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->fillbackground = mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillBackground>(msg, data, { FALSE,TRUE }, m_scanparam->fillbackground, Bool(true), m_scanparam->fillbackground ? 1 : 0, 1);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillBackground>(msg, data, m_scanparam->fillbackground, true);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillBackground>(msg, data, { FALSE,TRUE }, m_scanparam->fillbackground, Bool(true), m_scanparam->fillbackground ? 1 : 0, 1);
|
||||
};
|
||||
|
||||
//裁剪纠偏轮廓缩进像素
|
||||
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = [this](Msg msg, Capability& data)->Result {
|
||||
|
@ -1473,6 +1483,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
}
|
||||
return CapSupGetAllResetEx<int, UInt32, (CapType)CapTypeEx::TwEx_CroporDesaskewIndent>(msg, data, m_scanparam->indent, 5);
|
||||
};
|
||||
|
||||
//自动裁剪降噪像素
|
||||
m_query[(CapType)(CapTypeEx::TwEx_CropNoise)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_CropNoise)] = [this](Msg msg, Capability& data)->Result {
|
||||
|
@ -1516,7 +1527,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->fillhole.is_fillhole = mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillHole>(msg, data, { FALSE,TRUE }, m_scanparam->fillhole.is_fillhole, Bool(true), m_scanparam->fillhole.is_fillhole ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillHole>(msg, data, m_scanparam->fillhole.is_fillhole, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillHole>(msg, data, { FALSE,TRUE }, m_scanparam->fillhole.is_fillhole, Bool(false), m_scanparam->fillhole.is_fillhole ? 1 : 0, 0);
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_IFillHoleRatio)] = msgSupportGetAllSetReset;
|
||||
|
@ -1541,7 +1553,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->detachnoise.is_detachnoise = mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IDetachNoise>(msg, data, { FALSE,TRUE }, m_scanparam->detachnoise.is_detachnoise, FALSE, m_scanparam->detachnoise.is_detachnoise ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IDetachNoise>(msg, data, m_scanparam->detachnoise.is_detachnoise, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IDetachNoise>(msg, data, { FALSE,TRUE }, m_scanparam->detachnoise.is_detachnoise, FALSE, m_scanparam->detachnoise.is_detachnoise ? 1 : 0, 0);
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_IDetachNoiseValue)] = msgSupportGetAllSetReset;
|
||||
|
@ -1567,7 +1580,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->multi_output_red = 0;//非彩色 不能使用多流除红
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IMultiOutputRed>(msg, data, { FALSE,TRUE }, m_scanparam->multi_output_red, FALSE, m_scanparam->multi_output_red ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IMultiOutputRed>(msg, data, m_scanparam->multi_output_red, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IMultiOutputRed>(msg, data, { FALSE,TRUE }, m_scanparam->multi_output_red, FALSE, m_scanparam->multi_output_red ? 1 : 0, 0);
|
||||
};
|
||||
//答题卡除红
|
||||
m_query[(CapType)(CapTypeEx::TwEx_HsvCorrect)] = msgSupportGetAllSetReset;
|
||||
|
@ -1577,7 +1591,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->hsvcorrect = mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_HsvCorrect>(msg, data, { FALSE,TRUE }, m_scanparam->hsvcorrect, FALSE, m_scanparam->hsvcorrect ? 1 : 0, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_HsvCorrect>(msg, data, m_scanparam->hsvcorrect, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_HsvCorrect>(msg, data, { FALSE,TRUE }, m_scanparam->hsvcorrect, FALSE, m_scanparam->hsvcorrect ? 1 : 0, 0);
|
||||
};
|
||||
|
||||
m_query[CapType::IFilter] = msgSupportGetAllSetReset;
|
||||
|
@ -1626,7 +1641,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Enchace_Color, (CapType)CapTypeEx::TwEx_IEnhanceColor>(msg, data, { Enchace_Color::Enhance_None,Enchace_Color::Enhance_Red,Enchace_Color::Enhance_Green,Enchace_Color::Enhance_Blue }, m_scanparam->enhance_color, Enchace_Color::Enhance_None, m_scanparam->enhance_color, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Enchace_Color, (CapType)CapTypeEx::TwEx_IEnhanceColor>(msg, data, m_scanparam->enhance_color, (Enchace_Color)0);
|
||||
//return CapSupGetAllResetEx<BYTE, Enchace_Color, (CapType)CapTypeEx::TwEx_IEnhanceColor>(msg, data, { Enchace_Color::Enhance_None,Enchace_Color::Enhance_Red,Enchace_Color::Enhance_Green,Enchace_Color::Enhance_Blue }, m_scanparam->enhance_color, Enchace_Color::Enhance_None, m_scanparam->enhance_color, 0);
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_Sharpen)] = msgSupportGetAllSetReset;
|
||||
|
@ -1638,7 +1654,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->sharpen = (BYTE)mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, SharpenBlur, (CapType)CapTypeEx::TwEx_Sharpen>(msg, data, { SharpenBlur::Sharpen_None,SharpenBlur::Sharpen_Normal,SharpenBlur::Sharpen_More,SharpenBlur::Sharpen_Blur,SharpenBlur::Sharpen_Blur_More }, m_scanparam->sharpen, SharpenBlur::Sharpen_None, m_scanparam->sharpen, 0);
|
||||
return CapSupGetAllResetEx<BYTE, SharpenBlur, (CapType)CapTypeEx::TwEx_Sharpen>(msg, data, m_scanparam->sharpen, SharpenBlur::Sharpen_Normal);
|
||||
//return CapSupGetAllResetEx<BYTE, SharpenBlur, (CapType)CapTypeEx::TwEx_Sharpen>(msg, data, { SharpenBlur::Sharpen_None,SharpenBlur::Sharpen_Normal,SharpenBlur::Sharpen_More,SharpenBlur::Sharpen_Blur,SharpenBlur::Sharpen_Blur_More }, m_scanparam->sharpen, SharpenBlur::Sharpen_None, m_scanparam->sharpen, 0);
|
||||
};
|
||||
|
||||
/*亮度 对比度 gamma range类型 Range 类型*/
|
||||
|
@ -1720,60 +1737,6 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
//m_query[(CapType)(CapTypeEx::TwEx_DBAreaNum)] = msgSupportGetAllSetReset;
|
||||
//m_caps[(CapType)(CapTypeEx::TwEx_DBAreaNum)] = [this](Msg msg, Capability& data)->Result {
|
||||
// switch (msg) {
|
||||
// case Msg::Get:
|
||||
// data = Capability::createOneValue<UInt16>((CapType)(CapTypeEx::TwEx_DBAreaNum), m_scanparam->areanum);
|
||||
// return success();
|
||||
// case Msg::Reset:
|
||||
// m_scanparam->areanum = 8;
|
||||
// case Msg::GetCurrent:
|
||||
// data = Capability::createOneValue<UInt16>((CapType)(CapTypeEx::TwEx_DBAreaNum), m_scanparam->areanum);
|
||||
// return success();
|
||||
// case Msg::GetDefault:
|
||||
// data = Capability::createOneValue<UInt16>((CapType)(CapTypeEx::TwEx_DBAreaNum), UInt16(8));
|
||||
// return success();
|
||||
// case Msg::Set: {
|
||||
// auto mech = data.currentItem<UInt16>();
|
||||
// if (mech >= 5 && mech <= 40) {
|
||||
// m_scanparam->areanum = mech;
|
||||
// return success();
|
||||
// }
|
||||
// return badValue();
|
||||
// }
|
||||
// default:
|
||||
// return capBadOperation();
|
||||
// }
|
||||
//};
|
||||
|
||||
//m_query[(CapType)(CapTypeEx::TwEx_DBDevnMax)] = msgSupportGetAllSetReset;
|
||||
//m_caps[(CapType)(CapTypeEx::TwEx_DBDevnMax)] = [this](Msg msg, Capability& data)->Result {
|
||||
// switch (msg) {
|
||||
// case Msg::Get:
|
||||
// data = Capability::createOneValue<UInt16>((CapType)(CapTypeEx::TwEx_DBDevnMax), m_scanparam->devnmax);
|
||||
// return success();
|
||||
// case Msg::Reset:
|
||||
// m_scanparam->devnmax = 200;
|
||||
// case Msg::GetCurrent:
|
||||
// data = Capability::createOneValue<UInt16>((CapType)(CapTypeEx::TwEx_DBDevnMax), m_scanparam->devnmax);
|
||||
// return success();
|
||||
// case Msg::GetDefault:
|
||||
// data = Capability::createOneValue<UInt16>((CapType)(CapTypeEx::TwEx_DBDevnMax), UInt16(200));
|
||||
// return success();
|
||||
// case Msg::Set: {
|
||||
// auto mech = data.currentItem<UInt16>();
|
||||
// if (mech >= 150 && mech <= 400) {
|
||||
// m_scanparam->devnmax = mech;
|
||||
// return success();
|
||||
// }
|
||||
// return badValue();
|
||||
// }
|
||||
// default:
|
||||
// return capBadOperation();
|
||||
// }
|
||||
//};
|
||||
/*以下为硬件协议*/
|
||||
m_query[(CapType)(CapTypeEx::TwEx_ScrewDetectEnable)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_ScrewDetectEnable)] = [this](Msg msg, Capability& data)->Result {
|
||||
|
@ -1783,8 +1746,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
return success();
|
||||
}
|
||||
Bool en = m_scanparam->hardwarecaps.en_skrewdetect == 0 ? Bool(false) : Bool(true);
|
||||
//return CapSupGetAllReset<Bool, Bool, (CapType)(CapTypeEx::TwEx_ScrewDetectEnable)>(msg, data,en , Bool(true));
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_ScrewDetectEnable>(msg, data, { FALSE ,TRUE }, m_scanparam->hardwarecaps.en_skrewdetect, TRUE, m_scanparam->hardwarecaps.en_skrewdetect ? 1 : 0, 1);
|
||||
return CapSupGetAllResetEx<Bool, Bool, (CapType)(CapTypeEx::TwEx_ScrewDetectEnable)>(msg, data,(Bool)m_scanparam->hardwarecaps.en_skrewdetect , Bool(true));
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_ScrewDetectEnable>(msg, data, { FALSE ,TRUE }, m_scanparam->hardwarecaps.en_skrewdetect, TRUE, m_scanparam->hardwarecaps.en_skrewdetect ? 1 : 0, 1);
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_ScrewLevel)] = msgSupportGetAllSetReset;
|
||||
|
@ -1809,7 +1772,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_StableDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->hardwarecaps.en_stapledetect, FALSE, m_scanparam->hardwarecaps.en_stapledetect==0 ? 0 : 1, 0);
|
||||
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_StableDetectEnable>(msg, data, m_scanparam->hardwarecaps.en_stapledetect, false);
|
||||
//return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_StableDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->hardwarecaps.en_stapledetect, FALSE, m_scanparam->hardwarecaps.en_stapledetect==0 ? 0 : 1, 0);
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_DogEarDelection)] = msgSupportGetAllSetReset;
|
||||
|
@ -1826,7 +1790,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_caps[CapType::DoubleFeedDetection] = [this](Msg msg, Capability& data)->Result {
|
||||
switch (msg) {
|
||||
case Msg::Get:
|
||||
data = Capability::createEnumeration<UInt16>(CapType::DoubleFeedDetection, { 0 }, m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1, 0);
|
||||
data = Capability::createEnumeration<UInt16>(CapType::DoubleFeedDetection, { 0 ,1}, m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1, 0);
|
||||
return { ReturnCode::Success, ConditionCode::Success };
|
||||
case Msg::GetCurrent:
|
||||
data = Capability::createOneValue<UInt16>(CapType::DoubleFeedDetection, (UInt16)m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1);
|
||||
|
@ -1862,9 +1826,10 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_scanparam->hardwarecaps.lowpowermode = (LowPowerMode)mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<LowPowerMode, UInt32, (CapType)CapTypeEx::TwEx_LowPowerMode>(msg, data,
|
||||
{ LowPowerMode::Min_None,LowPowerMode::Min_5,LowPowerMode::Min_10,LowPowerMode::Min_20, LowPowerMode::Min_30, LowPowerMode::Min_60, LowPowerMode::Min_120, LowPowerMode::Min_240 },
|
||||
m_scanparam->hardwarecaps.lowpowermode, LowPowerMode::Min_30, (BYTE)m_scanparam->hardwarecaps.lowpowermode, 4);
|
||||
return CapSupGetAllResetEx<LowPowerMode, UInt32, (CapType)CapTypeEx::TwEx_LowPowerMode>(msg, data, m_scanparam->hardwarecaps.lowpowermode, LowPowerMode::Min_30);
|
||||
//return CapSupGetAllResetEx<LowPowerMode, UInt32, (CapType)CapTypeEx::TwEx_LowPowerMode>(msg, data,
|
||||
// { LowPowerMode::Min_None,LowPowerMode::Min_5,LowPowerMode::Min_10,LowPowerMode::Min_20, LowPowerMode::Min_30, LowPowerMode::Min_60, LowPowerMode::Min_120, LowPowerMode::Min_240 },
|
||||
// m_scanparam->hardwarecaps.lowpowermode, LowPowerMode::Min_30, (BYTE)m_scanparam->hardwarecaps.lowpowermode, 4);
|
||||
};
|
||||
#endif // LANXUM
|
||||
|
||||
|
@ -1872,9 +1837,11 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
m_query[(CapType)(CapTypeEx::TwEx_UVModel)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_UVModel)] = [this](Msg msg, Capability& data)->Result {
|
||||
switch (msg) {
|
||||
case Msg::Get:
|
||||
data = Capability::createEnumeration<Bool>((CapType)(CapTypeEx::TwEx_UVModel), { Bool(),Bool(true) }, Bool(m_scanparam->hardwarecaps.en_uv), 0);
|
||||
case Msg::Get:{
|
||||
data = Capability::createOneValue<Bool>((CapType)(CapTypeEx::TwEx_UVModel), Bool(m_scanparam->hardwarecaps.en_uv));
|
||||
//data = Capability::createEnumeration<Bool>((CapType)(CapTypeEx::TwEx_UVModel), { Bool(),Bool(true) }, Bool(m_scanparam->hardwarecaps.en_uv), 0);
|
||||
return success();
|
||||
}
|
||||
case Msg::Reset:
|
||||
m_scanparam->hardwarecaps.en_uv = false;
|
||||
case Msg::GetCurrent:
|
||||
|
@ -1885,7 +1852,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
return success();
|
||||
case Msg::Set: {
|
||||
auto mech = data.currentItem<Bool>();
|
||||
m_scanparam->hardwarecaps.en_uv = mech;
|
||||
m_scanparam->hardwarecaps.en_uv = mech?1:0;
|
||||
return success();
|
||||
}
|
||||
default:
|
||||
|
@ -1950,17 +1917,17 @@ Result HuagaoDs::pendingXfersEnd(const Identity&, PendingXfers& data) {
|
|||
{
|
||||
int num = 0;
|
||||
if (m_scanparam->is_duplex && m_scanparam->en_fold && m_scanparam->multi_output_red)
|
||||
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 2 - scanner->get_imgTransfered();
|
||||
else if (m_scanparam->is_duplex && m_scanparam->en_fold)
|
||||
num = scanner->get_aquire_image_count() - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() - scanner->get_imgTransfered();
|
||||
else if (m_scanparam->is_duplex && m_scanparam->multi_output_red)
|
||||
num = scanner->get_aquire_image_count() * 4 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 4 - scanner->get_imgTransfered();
|
||||
else if ((!m_scanparam->is_duplex) && m_scanparam->multi_output_red)
|
||||
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 2 - scanner->get_imgTransfered();
|
||||
else if (!m_scanparam->is_duplex)
|
||||
num = scanner->get_aquire_image_count() - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() - scanner->get_imgTransfered();
|
||||
else
|
||||
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
|
||||
num = scanner->get_imgnReaded() * 2 - scanner->get_imgTransfered();
|
||||
if (num != 0)
|
||||
{
|
||||
showmsg("警告", msgs[LOSE_IMAGE]);
|
||||
|
@ -2020,7 +1987,6 @@ Result HuagaoDs::userInterfaceDisable(const Identity&, UserInterface& ui) {
|
|||
Result HuagaoDs::userInterfaceEnable(const Identity&, UserInterface& ui) {
|
||||
m_pendingXfers = 1;
|
||||
m_memXferYOff = 0;
|
||||
scanner->ResetMsgFiter();
|
||||
|
||||
if (!ui.showUi()) {
|
||||
// this is an exception when we want to set state explicitly, notifyXferReady can be called only in enabled state
|
||||
|
@ -2191,10 +2157,7 @@ Result HuagaoDs::imageMemXferGet(const Identity& origin, ImageMemXfer& data) {
|
|||
|
||||
return success();
|
||||
}
|
||||
//#define LOG_NORMAL
|
||||
#ifdef LOG_NORMAL
|
||||
static int xtfer = 0;
|
||||
#endif
|
||||
|
||||
static int xtfer = 0;
|
||||
Result HuagaoDs::imageNativeXferGet(const Identity& id, ImageNativeXfer& data) {
|
||||
if (!m_pendingXfers) {
|
||||
|
@ -2532,7 +2495,7 @@ Twpp::Result HuagaoDs::startScan()
|
|||
guiIndicator->Create(IDD_INDICATOR, guiTwain.get() ? guiTwain.get() : guiBridge.get());//guiTwain ? guiTwain.get() : guiBridge.get()
|
||||
guiIndicator->ShowWindow(SW_SHOWNORMAL);
|
||||
}
|
||||
scanner->set_aquire_image_count(0, 0);
|
||||
scanner->UpdateScanInfo(0, 0);
|
||||
scanner->Scanner_StartScan(m_scanparam->scannum);
|
||||
if (bmpData->size() > 0)
|
||||
{
|
||||
|
|
|
@ -91,7 +91,6 @@ private://method
|
|||
Twpp::UInt32 bmpSize() const noexcept;
|
||||
const char* bmpBegin() const noexcept;
|
||||
const char* bmpEnd() const noexcept;
|
||||
void dogear_callback(int indexpaper);
|
||||
void updataGscanCap();
|
||||
Twpp::Result capCommon(const Twpp::Identity& origin, Twpp::Msg msg, Twpp::Capability& data);
|
||||
void showmsg(std::string caption, std::string text, int retcode=0);
|
||||
|
|
BIN
huagao/stdafx.h
BIN
huagao/stdafx.h
Binary file not shown.
Loading…
Reference in New Issue