From 3d939f21e2a994c1d023e465678f25591f34555e Mon Sep 17 00:00:00 2001 From: masayume <1936714878@qq.com> Date: Tue, 29 Dec 2020 21:33:26 +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?=E5=8F=82=E6=95=B0=E4=B8=BA=2051=20=2010=20=2030=20=20235=202?= =?UTF-8?q?=E9=BB=91=E7=99=BD=E9=BB=98=E8=AE=A4=E7=BA=A2=E8=89=B2=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- huagao/CImageProcPage.cpp | 1 + huagao/CTwainUI.cpp | 7 ++++- huagao/Device/ImageMatQueue.cpp | 2 +- huagao/ImageProcess/ImageApplyAutoCrop.cpp | 2 +- huagao/ImageProcess/ImageApplyBWBinaray.cpp | 4 +-- .../ImageProcess/ImageApplyDiscardBlank.cpp | 2 +- huagao/huagaods.cpp | 24 ++++++++++-------- huagao/stdafx.h | Bin 10774 -> 10766 bytes 8 files changed, 26 insertions(+), 16 deletions(-) diff --git a/huagao/CImageProcPage.cpp b/huagao/CImageProcPage.cpp index b95e235e..4427c8d4 100644 --- a/huagao/CImageProcPage.cpp +++ b/huagao/CImageProcPage.cpp @@ -79,6 +79,7 @@ void CImageProcPage::ImageProcPageUpdate(int val,bool is_Crop) if (val == 2) { ((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->EnableWindow(true); + //m_temp->SetCurSel(4); } else { diff --git a/huagao/CTwainUI.cpp b/huagao/CTwainUI.cpp index c15a7f80..f0d945fe 100644 --- a/huagao/CTwainUI.cpp +++ b/huagao/CTwainUI.cpp @@ -518,7 +518,12 @@ 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 + //} UpdateUi(); } diff --git a/huagao/Device/ImageMatQueue.cpp b/huagao/Device/ImageMatQueue.cpp index 6c1ba5ee..d3aea1f7 100644 --- a/huagao/Device/ImageMatQueue.cpp +++ b/huagao/Device/ImageMatQueue.cpp @@ -215,7 +215,7 @@ void ImageMatQueue::setparam(const GScanCap& param) if (param.filter != 3 || param.enhance_color) { int channel = 0; //filter none r g b enhance none r g b if (param.filter != 3) { channel = param.filter; } - else { channel = param.enhance_color + 3; } + else { channel = param.enhance_color + 4; } m_iaList.push_back(shared_ptr(new CImageApplyChannel(static_cast(channel)))); } diff --git a/huagao/ImageProcess/ImageApplyAutoCrop.cpp b/huagao/ImageProcess/ImageApplyAutoCrop.cpp index e3e5bb30..30c9b047 100644 --- a/huagao/ImageProcess/ImageApplyAutoCrop.cpp +++ b/huagao/ImageProcess/ImageApplyAutoCrop.cpp @@ -103,7 +103,7 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side) cv::Point(thre_dst.cols - 1, thre_dst.rows - 1), cv::Point(0, thre_dst.rows - 1) }; std::vector> rectEdges{ rectEdge }; cv::drawContours(thre_dst, rectEdges, 0, cv::Scalar::all(0)); - cv::Mat element = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(m_indent, m_indent)); + cv::Mat element = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(m_indent*2, m_indent*2)); cv::erode(thre_dst, thre_dst, element, cv::Point(-1, -1), 1); } hierarchy.clear(); diff --git a/huagao/ImageProcess/ImageApplyBWBinaray.cpp b/huagao/ImageProcess/ImageApplyBWBinaray.cpp index 45095dd3..82351f69 100644 --- a/huagao/ImageProcess/ImageApplyBWBinaray.cpp +++ b/huagao/ImageProcess/ImageApplyBWBinaray.cpp @@ -36,8 +36,8 @@ void CImageApplyBWBinaray::apply(cv::Mat& pDib, int side) cv::cvtColor(pDib, pDib, cv::COLOR_BGR2GRAY); cv::Mat integ; - int blockSize = 25;//邻域尺寸 - int threshold = 1; + int blockSize = 51;//邻域尺寸 + int threshold = 10; int low = 30; int up = 235; int halfSize = blockSize / 2; diff --git a/huagao/ImageProcess/ImageApplyDiscardBlank.cpp b/huagao/ImageProcess/ImageApplyDiscardBlank.cpp index 4f0f1561..7919312f 100644 --- a/huagao/ImageProcess/ImageApplyDiscardBlank.cpp +++ b/huagao/ImageProcess/ImageApplyDiscardBlank.cpp @@ -116,7 +116,7 @@ cv::Mat CImageApplyDiscardBlank::getRoiMat(const cv::Mat& image) processRectR(image, rect, contour, scale, thresh, blobSize); cv::Rect rect2 = rect.boundingRect(); cv::Rect inRect = rect2 & cv::Rect(0, 0, image.cols, image.rows); - gap = cv::max(inRect.width - rect.size.width, inRect.height - rect.size.height) + 100; + gap = cv::max(inRect.width - rect.size.width, inRect.height - rect.size.height) + 20; inRect = cv::Rect(inRect.x + gap, inRect.y + gap, inRect.width - gap * 2, inRect.height - gap * 2); if (inRect.width <= 0 || inRect.height <= 0) diff --git a/huagao/huagaods.cpp b/huagao/huagaods.cpp index d975c27f..78cacf40 100644 --- a/huagao/huagaods.cpp +++ b/huagao/huagaods.cpp @@ -762,17 +762,20 @@ Result HuagaoDs::identityOpenDs(const Identity&) { if (mech == PixelType::Rgb || mech == PixelType::Gray || mech == PixelType::BlackWhite) { m_scanparam->pixtype = (int)mech; - if (m_scanparam->pixtype == (int)PixelType::Rgb) - { + if (m_scanparam->pixtype == (int)PixelType::Rgb){ m_scanparam->filter = (byte)Filter::None; m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_None; m_scanparam->automaticcolor = FALSE; } - else - { + else{ m_scanparam->multi_output_red = 0;//非彩色模式下多流输出不可用 //if (m_scanparam->pixtype == (int)PixelType::BlackWhite) // 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; + } } m_iBitdepth = mech == PixelType::Rgb ? 24 : (mech == PixelType::Gray ? 8 : 1); return success(); @@ -786,8 +789,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) { m_caps[CapType::IAutomaticColorEnabled] = [this](Msg msg, Capability& data)->Result { if (Msg::Set == msg) { auto mech = data.currentItem(); - if (mech) - { + if (mech){ m_scanparam->automaticcolor = TRUE; m_scanparam->filter = (byte)Filter::None; m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_None; @@ -805,10 +807,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) { m_caps[CapType::IAutomaticColorNonColorPixelType] = [this](Msg msg, Capability& data)->Result { if (msg == Msg::Set) { auto mech = data.currentItem(); - if (m_scanparam->automaticcolor == TRUE) - { - if ((UInt16)mech == 0 || (UInt16)mech == 1) - { + if (m_scanparam->automaticcolor == TRUE){ + if ((UInt16)mech == 0 || (UInt16)mech == 1){ m_scanparam->automaticcolortype = (UInt16)mech; return success(); } @@ -1373,6 +1373,10 @@ Result HuagaoDs::identityOpenDs(const Identity&) { m_scanparam->enhance_color = (byte)mech; if (mech != (byte)Enchace_Color::Enhance_None) m_scanparam->filter = (byte)Filter::None; + + if (m_scanparam->pixtype == (int)PixelType::BlackWhite) + m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; + return success(); } } diff --git a/huagao/stdafx.h b/huagao/stdafx.h index 9c1ba2d7ee567dbe6f8320c439f1bd13f33a29ac..bd4aa544ec468eb9260562eba5e3a3ee270ecf2f 100644 GIT binary patch delta 37 rcmbOh(igH}8waZqg8_rV