1.修复裁切算法bug(驱动中传入noise默认值不正确);

2.修复红色增强协议bug;
This commit is contained in:
lovelyyoung 2021-06-28 11:58:54 +08:00
parent 75d3cb941b
commit 9ae4e27f3e
9 changed files with 205 additions and 191 deletions

View File

@ -42,7 +42,7 @@ BOOL CAdvancedDLG::OnInitDialog()
CTabPageSSL::OnInitDialog(); CTabPageSSL::OnInitDialog();
m_Edit_noise.SetSlideLink(this, IDC_SLIDER_NOISE); m_Edit_noise.SetSlideLink(this, IDC_SLIDER_NOISE);
m_Edit_noise.SetParams(30, 50, 2); m_Edit_noise.SetParams(5, 50, 2);
m_Edit_noise.SetValue(noise); m_Edit_noise.SetValue(noise);
m_Edit_indent.SetSlideLink(this, IDC_SLIDER_INDENT); m_Edit_indent.SetSlideLink(this, IDC_SLIDER_INDENT);

View File

@ -39,7 +39,7 @@ CImageProcPage::CImageProcPage(CWnd* pParent /*=nullptr*/)
, m_ckbDetachNoise(FALSE) , m_ckbDetachNoise(FALSE)
, m_ckbHSVCorrect(FALSE) , m_ckbHSVCorrect(FALSE)
, indent(5) , indent(5)
, noise(40) , noise(8)
,threshold(40) ,threshold(40)
,is_bw(false) ,is_bw(false)
{ {
@ -130,7 +130,7 @@ BOOL CImageProcPage::OnInitDialog()
m_edit_hole.SetValue(0.10); m_edit_hole.SetValue(0.10);
m_edit_detachnoise.SetSlideLink(this, IDC_SLIDERDETACHNOISE); m_edit_detachnoise.SetSlideLink(this, IDC_SLIDERDETACHNOISE);
m_edit_detachnoise.SetParams(10, 50, 10); m_edit_detachnoise.SetParams(0, 50, 10);
m_edit_detachnoise.SetValue(detachnoise); m_edit_detachnoise.SetValue(detachnoise);
((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(is_detachnoise); ((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(is_detachnoise);

View File

@ -752,11 +752,11 @@ USBCB GScanO200::Get_Scanner_Status()
if (m_usb.get() && m_usb->is_connected()) if (m_usb.get() && m_usb->is_connected())
m_usb->read_bulk(&usbcb, sizeof(usbcb)); m_usb->read_bulk(&usbcb, sizeof(usbcb));
if (usbcb.u32_CMD != GET_DSP_STATUS) //if (usbcb.u32_CMD != GET_DSP_STATUS)
{ //{
FileTools::writelog(log_ERROR, "get dsp status usb bulk error"); // FileTools::writelog(log_ERROR, "get dsp status usb bulk error");
return { NO_COMMAND,USB_BULK_ERROR,0 }; // return { NO_COMMAND,USB_BULK_ERROR,0 };
} //}
return usbcb; return usbcb;
} }

View File

@ -424,6 +424,10 @@ void ImageMatQueue::proc()
fwb.Close(); fwb.Close();
remove(path.c_str()); remove(path.c_str());
} }
else
{
FileTools::writelog(log_ERROR, "error while opening filename:" + path);
}
} }
else else
FileTools::writelog(log_ERROR, "open file error filename:" + path); FileTools::writelog(log_ERROR, "open file error filename:" + path);

View File

@ -69,7 +69,7 @@ GScanCap GscanJsonConfig::GetDefaultGscancapValue()
gcap.is_backrotate180 = FALSE; gcap.is_backrotate180 = FALSE;
gcap.AutoCrop_threshold = 40; gcap.AutoCrop_threshold = 40;
gcap.is_convex = TRUE; gcap.is_convex = TRUE;
gcap.noise = 40; gcap.noise = 8;
gcap.indent = 5; gcap.indent = 5;
gcap.is_dogeardetection = FALSE; gcap.is_dogeardetection = FALSE;
gcap.scannum = -1;//ĬÈÏÁ¬ÐøɨÃè gcap.scannum = -1;//ĬÈÏÁ¬ÐøɨÃè
@ -843,7 +843,7 @@ json GscanJsonConfig::GetDefaultJson()
"dogeardetection": false , "dogeardetection": false ,
"bScrewDetect": true , "bScrewDetect": true ,
"iScrewLevel": 3 , "iScrewLevel": 3 ,
"Noise": 40 , "Noise": 8 ,
"Indent": 5 , "Indent": 5 ,
"AutoCrop_Threshold": 40 , "AutoCrop_Threshold": 40 ,
"isConvex": true , "isConvex": true ,

View File

@ -37,7 +37,7 @@ public:
* noise [in]:noise宽度的背景竖条纹干扰40 * noise [in]:noise宽度的背景竖条纹干扰40
* indent [in]:indent像素5 * indent [in]:indent像素5
*/ */
CImageApplyAutoCrop(bool isCrop, bool isDesaskew, bool isFillBlank, const cv::Size& fixedSize, bool isConvex = true, bool isFillColor = false, double threshold = 40, int noise = 40, int indent = 5); CImageApplyAutoCrop(bool isCrop, bool isDesaskew, bool isFillBlank, const cv::Size& fixedSize, bool isConvex = true, bool isFillColor = false, double threshold = 40, int noise = 8, int indent = 5);
virtual ~CImageApplyAutoCrop(); virtual ~CImageApplyAutoCrop();

View File

@ -19,7 +19,15 @@
class CImageApplyDetachNoise : public CImageApply class CImageApplyDetachNoise : public CImageApply
{ {
public: public:
CImageApplyDetachNoise(int noise = 1); CImageApplyDetachNoise(int
= 1);
inline int getNoise() { return m_noise; } inline int getNoise() { return m_noise; }

View File

@ -12,7 +12,7 @@
#include "resource.h" #include "resource.h"
#include "CTwainUI.h" #include "CTwainUI.h"
#include "CIndicatorDlg.h" #include "CIndicatorDlg.h"
#include "Cmsgbox.h" //#include "Cmsgbox.h"
#include "Device/PublicFunc.h" #include "Device/PublicFunc.h"
#include "Device/GScanO200.h" #include "Device/GScanO200.h"
#include "Device/GScanO400.h" #include "Device/GScanO400.h"
@ -279,7 +279,7 @@ static void DeleteWnd(CDialog* pWnd) {
} }
static std::unique_ptr<CTwainUI, void(*)(CDialog*)> guiTwain(nullptr, DeleteWnd); static std::unique_ptr<CTwainUI, void(*)(CDialog*)> guiTwain(nullptr, DeleteWnd);
static std::unique_ptr<Cmsgbox> msgbox; //static std::unique_ptr<Cmsgbox> msgbox;
#if TWPP_DETAIL_OS_WIN #if TWPP_DETAIL_OS_WIN
static std::unique_ptr<CDialog, void(*)(CDialog*)> guiBridge(nullptr, DeleteWnd); static std::unique_ptr<CDialog, void(*)(CDialog*)> guiBridge(nullptr, DeleteWnd);
@ -1477,7 +1477,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->noise = mech; m_scanparam->noise = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<int, UInt8, (CapType)CapTypeEx::TwEx_CropNoise>(msg, data, m_scanparam->noise, 40); return CapSupGetAllResetEx<int, UInt8, (CapType)CapTypeEx::TwEx_CropNoise>(msg, data, m_scanparam->noise, 8);
}; };
//自动裁切和纠偏的二值化阀值 //自动裁切和纠偏的二值化阀值
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold)] = msgSupportGetAllSetReset;
@ -1595,28 +1595,30 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[(CapType)(CapTypeEx::TwEx_IEnhanceColor)] = [this](Msg msg, Capability& data)->Result { m_caps[(CapType)(CapTypeEx::TwEx_IEnhanceColor)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto mech = data.currentItem<Int16>(); auto mech = data.currentItem<Int16>();
if (m_scanparam->pixtype == (BYTE)PixelType::Rgb){ if (m_scanparam->pixtype == (int)PixelType::Rgb)
{
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
m_scanparam->filter = (BYTE)Filter::None;
return badValue();
} }
else{ else
{
if (mech == Enchace_Color::Enhance_None || mech == Enchace_Color::Enhance_Red || mech == Enchace_Color::Enhance_Green || mech == Enchace_Color::Enhance_Blue) if (mech == Enchace_Color::Enhance_None || mech == Enchace_Color::Enhance_Red || mech == Enchace_Color::Enhance_Green || mech == Enchace_Color::Enhance_Blue)
{ {
m_scanparam->enhance_color = (BYTE)mech; m_scanparam->enhance_color = (BYTE)mech;
if (mech != (BYTE)Enchace_Color::Enhance_None) if (mech != (BYTE)Enchace_Color::Enhance_None)
m_scanparam->filter = (BYTE)Filter::None; m_scanparam->filter = (BYTE)Filter::None;
if (m_scanparam->pixtype == (int)PixelType::BlackWhite) if (m_scanparam->pixtype == (int)PixelType::BlackWhite)//黑白默认开启红色增强 其他增强不生效
{ {
if (m_scanparam->filter == (BYTE)Filter::None && m_scanparam->enhance_color == (BYTE)Enchace_Color::Enhance_None) if (m_scanparam->enhance_color == (BYTE)Enchace_Color::Enhance_None)
{ {
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red;
} }
} }
return success(); return success();
} }
} }
return badValue();
} }
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, { 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);
}; };

Binary file not shown.