mirror of http://192.168.1.51:8099/lmh188/twain3.0
高于300dpi改为文件缓存模式
This commit is contained in:
parent
043aba521c
commit
2d276cd03b
|
@ -457,10 +457,20 @@ void GScanO1003399::usb_run()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while (!scanner_read_reg(m_usb, SR_GET_IMAGEPROCESSDONE))
|
while (!scanner_read_reg(m_usb, SR_GET_IMAGEPROCESSDONE))
|
||||||
this_thread::sleep_for(chrono::microseconds(30));
|
this_thread::sleep_for(chrono::microseconds(30));
|
||||||
if (m_param.is_duplex)
|
if (scanner_read_reg(m_usb, SR_GET_KEEP_LAST_PAPER))
|
||||||
|
{
|
||||||
|
this_thread::sleep_for(chrono::milliseconds(100));
|
||||||
|
im_rx();
|
||||||
|
if (m_param.is_duplex)
|
||||||
|
pop_dev_im();
|
||||||
pop_dev_im();
|
pop_dev_im();
|
||||||
pop_dev_im();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
keeplastimg = false;
|
||||||
|
im_rx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scanflag = false;
|
scanflag = false;
|
||||||
if ((devState != DEV_WRONG) && (get_ErrorCode()<=0))
|
if ((devState != DEV_WRONG) && (get_ErrorCode()<=0))
|
||||||
|
@ -569,10 +579,40 @@ void GScanO1003399::im_rx()
|
||||||
else
|
else
|
||||||
image++;
|
image++;
|
||||||
UpdateScanInfo(countNReaded(), get_imgTransfered());
|
UpdateScanInfo(countNReaded(), get_imgTransfered());
|
||||||
imgs.Put(buffi);
|
if (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131)
|
||||||
|
{
|
||||||
|
auto path = cv::tempfile();
|
||||||
|
auto fd = fopen(path.c_str(), "wr+");
|
||||||
|
if (fd)
|
||||||
|
{
|
||||||
|
fwrite(buffi->data(), buffi->size(), 1, fd);
|
||||||
|
fclose(fd);
|
||||||
|
m_paths.push(path);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FileTools::writelog(log_ERROR, "img temp file save error flie name =" + path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
imgs.Put(buffi);
|
||||||
|
}
|
||||||
fu_imgpro.push(m_imgprocthread.enqueue([this] {
|
fu_imgpro.push(m_imgprocthread.enqueue([this] {
|
||||||
imgproce(imgs.Take());
|
if (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131)
|
||||||
}));
|
{
|
||||||
|
if (m_imagedata.Size() > 1)
|
||||||
|
{
|
||||||
|
this_thread::sleep_for(chrono::milliseconds(10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imgproce(imgs.Take());
|
||||||
|
}
|
||||||
|
}));
|
||||||
while (fu_imgpro.size()>1)
|
while (fu_imgpro.size()>1)
|
||||||
{
|
{
|
||||||
fu_imgpro.front().get();
|
fu_imgpro.front().get();
|
||||||
|
|
|
@ -85,6 +85,8 @@ private:
|
||||||
ThreadPool m_imgprocthread;
|
ThreadPool m_imgprocthread;
|
||||||
std::shared_ptr<std::thread> m_usbthread;
|
std::shared_ptr<std::thread> m_usbthread;
|
||||||
std::shared_ptr<std::vector<char>> im_data;
|
std::shared_ptr<std::vector<char>> im_data;
|
||||||
|
|
||||||
|
std::queue<std::string> m_paths;
|
||||||
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> m_imagedata;
|
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> m_imagedata;
|
||||||
std::atomic_int image;
|
std::atomic_int image;
|
||||||
void* huagods;
|
void* huagods;
|
||||||
|
|
|
@ -179,6 +179,7 @@ enum Scanner_Reg_Defs
|
||||||
SR_GET_SLEEPTIME,
|
SR_GET_SLEEPTIME,
|
||||||
SR_GET_SLEEP_STAUTUS,
|
SR_GET_SLEEP_STAUTUS,
|
||||||
SR_GET_IMAGEPROCESSDONE,
|
SR_GET_IMAGEPROCESSDONE,
|
||||||
|
SR_GET_KEEP_LAST_PAPER,
|
||||||
SR_GET_CUO_ERROR = 0x50,
|
SR_GET_CUO_ERROR = 0x50,
|
||||||
SR_GET_DOU_ERROR,
|
SR_GET_DOU_ERROR,
|
||||||
SR_GET_JAM_ERROR,
|
SR_GET_JAM_ERROR,
|
||||||
|
|
Loading…
Reference in New Issue