mirror of http://192.168.1.51:8099/lmh188/twain3.0
修改G100,G200不显示UI时,畸变参数不生效问题
This commit is contained in:
parent
564d1d94a3
commit
359ee319eb
|
@ -224,7 +224,12 @@ void GScanO200::open(int vid, int pid)
|
|||
m_usb->set_usbhotplug_callback(usbhotplug_callback, this);
|
||||
}
|
||||
}
|
||||
#ifdef G200
|
||||
if (this->IsConnected())
|
||||
GetFWVersion();
|
||||
#endif // G200
|
||||
}
|
||||
|
||||
void GScanO200::regist_deviceevent_callback(deviceevent_callback callback, void* usrdata)
|
||||
{
|
||||
huagods = usrdata;
|
||||
|
@ -388,8 +393,7 @@ void GScanO200::Scanner_StartScan(UINT16 count)
|
|||
devState = DEV_STOP;
|
||||
m_threadUsb->join();
|
||||
}
|
||||
|
||||
USBCB status = { GET_DSP_STATUS ,0,0 };
|
||||
USBCB status = { GET_DSP_STATUS ,0,0 };
|
||||
if (m_usb.get() && m_usb->is_connected())
|
||||
m_usb->write_bulk(&status, sizeof(status));
|
||||
if (m_usb.get() && m_usb->is_connected())
|
||||
|
|
|
@ -358,7 +358,7 @@ void ImageMatQueue::proc()
|
|||
writelog("decode image data error");
|
||||
}
|
||||
#ifdef G200
|
||||
cv::resize(mat, mat, cv::Size(), fx, fy);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动
|
||||
cv::resize(mat, mat, cv::Size(), fx,fy);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动
|
||||
mats.push_back(mat);
|
||||
mat.release();
|
||||
#else // G200
|
||||
|
@ -370,10 +370,10 @@ void ImageMatQueue::proc()
|
|||
cv::flip(front, front, 0);
|
||||
cv::flip(front, front, 1);
|
||||
}
|
||||
FileTools::write_log("scanParam.imageRotateDegree-" + to_string(scanParam.imageRotateDegree));
|
||||
mats.push_back(back);
|
||||
mats.push_back(front);
|
||||
#endif
|
||||
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "ImageApplyBWBinaray.h"
|
||||
#include "ImageApplyDetachNoise.h"
|
||||
|
||||
CImageApplyBWBinaray::CImageApplyBWBinaray(ThresholdType type, int threshold, int blockSize, int constant)
|
||||
: m_threshold(threshold)
|
||||
|
@ -37,13 +36,12 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side)
|
|||
cv::cvtColor(pDib, pDib, cv::COLOR_BGR2GRAY);
|
||||
|
||||
cv::Mat integ;
|
||||
int blockSize = 31;//ÁÚÓò³ß´ç
|
||||
int threshold = 21;
|
||||
int blockSize = 13;//ÁÚÓò³ß´ç
|
||||
int threshold = 1;
|
||||
int low = 110;
|
||||
int up = 220;
|
||||
int up = 230;
|
||||
int halfSize = blockSize / 2;
|
||||
int square_blockSize = blockSize * blockSize;
|
||||
CImageApplyDetachNoise noise(6);
|
||||
switch (m_type)
|
||||
{
|
||||
case ThresholdType::THRESH_BINARY:
|
||||
|
@ -69,7 +67,6 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side)
|
|||
cv::threshold(pDib(cv::Rect(pDib.cols - halfSize, 0, halfSize, pDib.rows)), pDib(cv::Rect(pDib.cols - halfSize, 0, halfSize, pDib.rows)), m_threshold, 255, cv::THRESH_BINARY);
|
||||
cv::threshold(pDib(cv::Rect(0, 0, pDib.cols, halfSize)), pDib(cv::Rect(0, 0, pDib.cols, halfSize)), m_threshold, 255, cv::THRESH_BINARY);
|
||||
cv::threshold(pDib(cv::Rect(0, pDib.rows - halfSize, pDib.cols, halfSize)), pDib(cv::Rect(0, pDib.rows - halfSize, pDib.cols, halfSize)), m_threshold, 255, cv::THRESH_BINARY);
|
||||
noise.apply(pDib, side);
|
||||
break;
|
||||
case ThresholdType::THRESH_OTSU:
|
||||
cv::threshold(pDib, pDib, m_threshold, 255, CV_THRESH_OTSU);
|
||||
|
|
|
@ -653,7 +653,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
return success();
|
||||
|
||||
case Msg::Reset:
|
||||
m_iBitdepth = 8;
|
||||
m_iBitdepth = 24;
|
||||
data = Capability::createOneValue<CapType::IBitDepth>(UInt16(m_iBitdepth));
|
||||
return success();
|
||||
break;
|
||||
|
@ -1146,6 +1146,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
case Msg::GetCurrent:
|
||||
case Msg::GetDefault:
|
||||
{
|
||||
FileTools::write_log("D:\\1.txt", "getfwversion");
|
||||
std::string ser = scanner->GetFWVersion();
|
||||
Str255 str;
|
||||
str.setData(ser.c_str(), ser.size());
|
||||
|
@ -2416,6 +2417,12 @@ Result HuagaoDs::pendingXfersEnd(const Identity&, PendingXfers& data) {
|
|||
#endif // G200
|
||||
}
|
||||
m_pendingXfers = 0;
|
||||
if (m_modal)
|
||||
{
|
||||
::EnableWindow(parent, true);
|
||||
m_modal = false;
|
||||
notifyCloseCancel();
|
||||
}
|
||||
if (guiTwain.get()) {
|
||||
((CTwainUI*)(guiTwain.get()))->EnableID_OKorID_Cancel(true);
|
||||
}
|
||||
|
@ -2796,6 +2803,12 @@ Twpp::Result HuagaoDs::showTwainUI(Twpp::UserInterface& ui, bool bUiOnly)
|
|||
// long appFlags = GetWindowLong(appWindow, GWL_STYLE);
|
||||
// SetWindowLong(appWindow, GWL_STYLE, appFlags | WS_DISABLED);
|
||||
//}
|
||||
if (ui.modalUi())
|
||||
{
|
||||
m_modal = true;
|
||||
parent = appWindow;
|
||||
::EnableWindow(appWindow, false);
|
||||
}
|
||||
}
|
||||
|
||||
//!< show ui to scan button push
|
||||
|
@ -2820,6 +2833,10 @@ Twpp::Result HuagaoDs::showTwainUI(Twpp::UserInterface& ui, bool bUiOnly)
|
|||
|
||||
//!< cancel button push
|
||||
auto cancelFunction = [this]() {
|
||||
if (m_modal)
|
||||
{
|
||||
::EnableWindow(parent, true);
|
||||
}
|
||||
notifyCloseCancel();
|
||||
};
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@ private://field
|
|||
bool m_bFeederEnabled = true;
|
||||
bool m_bAutoFeed = true;
|
||||
bool m_haveError = false;
|
||||
bool m_modal = false;
|
||||
HWND parent;
|
||||
UINT16 m_iBitdepth;
|
||||
Twpp::ImageFileFormat m_capImageFileFormat = Twpp::ImageFileFormat::Bmp;
|
||||
std::queue<Twpp::DeviceEvent> devEvent;
|
||||
|
|
BIN
huagao/stdafx.h
BIN
huagao/stdafx.h
Binary file not shown.
Loading…
Reference in New Issue