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();
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_indent.SetSlideLink(this, IDC_SLIDER_INDENT);

View File

@ -39,7 +39,7 @@ CImageProcPage::CImageProcPage(CWnd* pParent /*=nullptr*/)
, m_ckbDetachNoise(FALSE)
, m_ckbHSVCorrect(FALSE)
, indent(5)
, noise(40)
, noise(8)
,threshold(40)
,is_bw(false)
{
@ -130,7 +130,7 @@ BOOL CImageProcPage::OnInitDialog()
m_edit_hole.SetValue(0.10);
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);
((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())
m_usb->read_bulk(&usbcb, sizeof(usbcb));
if (usbcb.u32_CMD != GET_DSP_STATUS)
{
FileTools::writelog(log_ERROR, "get dsp status usb bulk error");
return { NO_COMMAND,USB_BULK_ERROR,0 };
}
//if (usbcb.u32_CMD != GET_DSP_STATUS)
//{
// FileTools::writelog(log_ERROR, "get dsp status usb bulk error");
// return { NO_COMMAND,USB_BULK_ERROR,0 };
//}
return usbcb;
}

View File

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

View File

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

View File

@ -37,7 +37,7 @@ public:
* noise [in]:noise宽度的背景竖条纹干扰40
* 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();

View File

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

View File

@ -12,7 +12,7 @@
#include "resource.h"
#include "CTwainUI.h"
#include "CIndicatorDlg.h"
#include "Cmsgbox.h"
//#include "Cmsgbox.h"
#include "Device/PublicFunc.h"
#include "Device/GScanO200.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<Cmsgbox> msgbox;
//static std::unique_ptr<Cmsgbox> msgbox;
#if TWPP_DETAIL_OS_WIN
static std::unique_ptr<CDialog, void(*)(CDialog*)> guiBridge(nullptr, DeleteWnd);
@ -1477,7 +1477,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->noise = mech;
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;
@ -1595,28 +1595,30 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[(CapType)(CapTypeEx::TwEx_IEnhanceColor)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
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->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)
{
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)
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;
}
}
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);
};

Binary file not shown.