From cc7d224b81cb6ae3a86abf0a9c831adb48189e54 Mon Sep 17 00:00:00 2001 From: masayume <1936714878@qq.com> Date: Wed, 30 Dec 2020 17:02:05 +0800 Subject: [PATCH] =?UTF-8?q?1)=E4=BF=AE=E6=94=B9=E4=BA=8C=E5=80=BC=E5=8C=96?= =?UTF-8?q?=E7=AE=97=E6=B3=95=E5=8F=83=E6=95=B8=E7=82=BA17=2020=20110=2023?= =?UTF-8?q?5=202)=E4=BF=AE=E6=94=B9=E9=A1=94=E8=89=B2=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=BC=BA=E9=A1=94=E8=89=B2=E5=8D=94=E8=AD=B0?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- huagao/CTwainUI.cpp | 16 ++++---- huagao/Device/GScan.h | 6 --- huagao/Device/GScanO200.cpp | 14 ------- huagao/Device/ImageMatQueue.cpp | 2 +- huagao/ImageProcess/ImageApplyAutoCrop.cpp | 6 --- huagao/ImageProcess/ImageApplyBWBinaray.cpp | 15 ++++---- huagao/huagaods.cpp | 40 ++++++++++++-------- huagao/stdafx.h | Bin 10766 -> 10774 bytes 8 files changed, 41 insertions(+), 58 deletions(-) diff --git a/huagao/CTwainUI.cpp b/huagao/CTwainUI.cpp index f0d945fe..1b86a559 100644 --- a/huagao/CTwainUI.cpp +++ b/huagao/CTwainUI.cpp @@ -85,7 +85,7 @@ BOOL CTwainUI::OnInitDialog() UpdateUI(); UpdateListConfig(); - dataChangeFunction(); + //dataChangeFunction(); return true; } @@ -518,12 +518,14 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs) #else // REAL300DPI settings->resolution_native = 200.0f; #endif - //if (settings->pixtype == TWPT_BW) - //{ - // settings->pixtype = TWPT_RGB; - // settings->enhance_color = Enchace_Color::Enhance_Red; - // settings->filter = 3;//none - //} + if (settings->pixtype == TWPT_BW) + { + if (settings->filter == 3 && settings->enhance_color <=1) + { + settings->enhance_color = Enchace_Color::Enhance_Red; + settings->filter = 3;//none + } + } UpdateUi(); } diff --git a/huagao/Device/GScan.h b/huagao/Device/GScan.h index 49d6b485..8d4b30c9 100644 --- a/huagao/Device/GScan.h +++ b/huagao/Device/GScan.h @@ -118,12 +118,6 @@ public: void DoEvents() { MSG msg; if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - //if (msg.message != WM_LBUTTONUP && bFilterMsg) - //{ - // FileTools::write_log("C:\\Users\\666\\Desktop\\1.txt", to_string(msg.message)); - // bFilterMsg = false; - // return; - //} DispatchMessage(&msg); TranslateMessage(&msg); } diff --git a/huagao/Device/GScanO200.cpp b/huagao/Device/GScanO200.cpp index 95009eb0..b15a6817 100644 --- a/huagao/Device/GScanO200.cpp +++ b/huagao/Device/GScanO200.cpp @@ -174,7 +174,6 @@ void GScanO200::Getimagenumber(bool isadd) { image_num--; } - //FileTools::write_log("1.txt", "image num :" + std::to_string(image_num)); } void GScanO200::DogEar_callback(std::function fun) @@ -526,9 +525,6 @@ void GScanO200::usbhotplug_callback(bool isconnect, void* userdata) void GScanO200::usbhotplug(bool isleft) { if (isleft) { - //std::lock_guard lck(m_Locker); - //FileTools:: - //("D:\\1.txt", "usbhotplug left"); devState = DEV_WRONG; Error_Code = USB_DISCONNECTED; m_pImages->setscanflags(false); @@ -553,7 +549,6 @@ void GScanO200::updateHVRatio() m_usb->write_bulk(&usbcb, sizeof(usbcb)); m_usb->read_bulk(&usbcb, sizeof(usbcb)); float vratio = *((float*)(&usbcb.u32_Data)); - //writelog("fx: " + to_string(hratio) + " fy :" + to_string(vratio)); m_pImages->updatefixratio(hratio, vratio); } } @@ -563,17 +558,14 @@ void GScanO200::usbmain() std::shared_ptr> imgData; devState = DEV_ISRUNNING; bool haveError = false; - ////FileTools::write_log("D:\\1.txt", "thread usb start"); try { StopWatch sw; while (devState == DEV_ISRUNNING) { if ((m_usb.get() && !m_usb->is_connected())) { this_thread::sleep_for(chrono::milliseconds(200)); - //FileTools::write_log("D:\\1.txt", "thread usb loop disconnect"); break; } - ////FileTools::write_log("D:\\1.txt", "thread usb start1"); //if (gcap.resolution_dst == 300.0f && gcap.en_fold) { // if (m_pImages->orginimgcount() > 1) @@ -613,12 +605,6 @@ void GScanO200::usbmain() } if(!m_pImages->get_isDogEar()) m_pImages->pushMat(std::shared_ptr(new G200Decode(imgData))); - //static int rawdataindex = 0; - //writelog("origin rawbuffer index " + std::to_string(++rawdataindex)); -#ifdef LOG_NORMAL - static int rawdataindex = 0; - //FileTools::write_log("out.txt", "Enquque rawbuffer index " + std::to_string(++rawdataindex)); -#endif // LOG m_usb->set_timeout(200); Pop_Image(); sw.reset(); diff --git a/huagao/Device/ImageMatQueue.cpp b/huagao/Device/ImageMatQueue.cpp index d3aea1f7..46aadce0 100644 --- a/huagao/Device/ImageMatQueue.cpp +++ b/huagao/Device/ImageMatQueue.cpp @@ -370,7 +370,7 @@ void ImageMatQueue::proc() cv::flip(front, front, 0); cv::flip(front, front, 1); } - FileTools::write_log("scanParam.imageRotateDegree-" + to_string(scanParam.imageRotateDegree)); + //FileTools::write_log("scanParam.imageRotateDegree-" + to_string(scanParam.imageRotateDegree)); mats.push_back(back); mats.push_back(front); #endif diff --git a/huagao/ImageProcess/ImageApplyAutoCrop.cpp b/huagao/ImageProcess/ImageApplyAutoCrop.cpp index 30c9b047..7f79f05c 100644 --- a/huagao/ImageProcess/ImageApplyAutoCrop.cpp +++ b/huagao/ImageProcess/ImageApplyAutoCrop.cpp @@ -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(); @@ -146,9 +143,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& mats, bool isTwoSide) diff --git a/huagao/ImageProcess/ImageApplyBWBinaray.cpp b/huagao/ImageProcess/ImageApplyBWBinaray.cpp index 82351f69..7995a25a 100644 --- a/huagao/ImageProcess/ImageApplyBWBinaray.cpp +++ b/huagao/ImageProcess/ImageApplyBWBinaray.cpp @@ -35,10 +35,13 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side) if (pDib.channels() == 3) cv::cvtColor(pDib, pDib, cv::COLOR_BGR2GRAY); - cv::Mat integ; - int blockSize = 51;//邻域尺寸 - int threshold = 10; - int low = 30; + //20.12.29 修改参数为51 10 30 235 + //20.12.30 修改参数为51 20 30 235 + // 修改参数为17 20 110 235 + cv::Mat integ; + int blockSize = 17;//邻域尺寸 + int threshold = 20; + int low = 110; int up = 235; int halfSize = blockSize / 2; int square_blockSize = blockSize * blockSize; @@ -83,10 +86,6 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side) default: break; } - -#ifdef LOG - FileTools::write_log("imgprc.txt", "exit CImageApplyBWBinaray apply"); -#endif // LOG } void CImageApplyBWBinaray::apply(std::vector& mats, bool isTwoSide) diff --git a/huagao/huagaods.cpp b/huagao/huagaods.cpp index 78cacf40..39190ab3 100644 --- a/huagao/huagaods.cpp +++ b/huagao/huagaods.cpp @@ -70,7 +70,7 @@ using namespace std::placeholders; TWPP_ENTRY_MFC(HuagaoDs) static constexpr const Identity srcIdent( - Version(3, 3, Language::English, Country::China, "v3.3.4.1"), + Version(3, 3, Language::English, Country::China, "v3.3.4.2"), DataGroup::Image, #ifdef MAKEHUAGAO "HUAGO", @@ -773,8 +773,11 @@ Result HuagaoDs::identityOpenDs(const Identity&) { // m_scanparam->sharpen = SharpenBlur::Sharpen_None; if (m_scanparam->pixtype == (int)PixelType::BlackWhite) { - m_scanparam->filter = (byte)Filter::None; - m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; + if (m_scanparam->filter == 3 && m_scanparam->enhance_color == 0) + { + m_scanparam->filter = (byte)Filter::None; + m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; + } } } m_iBitdepth = mech == PixelType::Rgb ? 24 : (mech == PixelType::Gray ? 8 : 1); @@ -905,7 +908,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) { ,PaperSize::A3,PaperSize::UsLedger,PaperSize::IsoB4, PaperSize::MaxSize,PaperSize::UsStatement #elif defined G400 - PaperSize::A3,,PaperSize::UsLedger,PaperSize::IsoB4 + ,PaperSize::A3,PaperSize::UsLedger,PaperSize::IsoB4 #endif #endif // },m_scanparam->papertype, PaperSize::A3, @@ -1375,8 +1378,13 @@ Result HuagaoDs::identityOpenDs(const Identity&) { m_scanparam->filter = (byte)Filter::None; if (m_scanparam->pixtype == (int)PixelType::BlackWhite) - m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; - + { + if (m_scanparam->filter == (byte)Filter::None && m_scanparam->enhance_color == (byte)Enchace_Color::Enhance_None) + { + m_scanparam->filter = (byte)Filter::None; + m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; + } + } return success(); } } @@ -2020,12 +2028,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); - } + //if (ui.modalUi()) + //{ + // m_modal = true; + // parent = appWindow; + // ::EnableWindow(appWindow, false); + //} } //!< show ui to scan button push @@ -2050,10 +2058,10 @@ Twpp::Result HuagaoDs::showTwainUI(Twpp::UserInterface& ui, bool bUiOnly) //!< cancel button push auto cancelFunction = [this]() { - if (m_modal) - { - ::EnableWindow(parent, true); - } + //if (m_modal) + //{ + // ::EnableWindow(parent, true); + //} notifyCloseCancel(); }; diff --git a/huagao/stdafx.h b/huagao/stdafx.h index bd4aa544ec468eb9260562eba5e3a3ee270ecf2f..cf28c67a2abec5f62c8d60a59b3adb9468bf7c34 100644 GIT binary patch delta 68 zcmeARnHI8P8waZ~g8_rVtxLG!{@kB8)8f{MGT`L0sty>c{ delta 67 zcmbOh(igH}8waZqg8_rV WW