mirror of http://192.168.1.51:8099/lmh188/twain3.0
UI开放色偏校正,增加色偏校正协议
This commit is contained in:
parent
009cc277b5
commit
2fdaa65f98
|
@ -81,3 +81,4 @@
|
|||
2.修复跳过空白页首选项配置保存问题 -- 22.11.28
|
||||
3.调整msvc与mfc链接顺序,默认开启多核编译
|
||||
4.添加色偏算法
|
||||
5.UI开放色偏校正,增加色偏校正协议 --23.01.05
|
|
@ -228,6 +228,13 @@ void CBasicPage::OnCbnSelchangeCmbcolortype()
|
|||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
updateCmbDuplex(TRUE);
|
||||
if (m_cmBoxColorMode->GetCurSel() != 0)
|
||||
{
|
||||
((CButton*)GetDlgItem(IDC_CKCOLORCAST))->SetCheck(FALSE);
|
||||
GetDlgItem(IDC_CKCOLORCAST)->EnableWindow(FALSE);
|
||||
}
|
||||
else
|
||||
GetDlgItem(IDC_CKCOLORCAST)->EnableWindow(TRUE);
|
||||
m_dataChange();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "twglue.hpp"
|
||||
#include <functional>
|
||||
|
||||
|
||||
// CBasicPage 对话框
|
||||
|
||||
class CBasicPage : public CTabPageSSL
|
||||
|
|
|
@ -99,6 +99,13 @@ BOOL CTwainUI::OnInitDialog()
|
|||
setvisable_size(true);
|
||||
if ((m_hardwareVersion[5] == 'B' && atoi(m_hardwareVersion.substr(6, 4).c_str()) >= 430) || (m_hardwareVersion[5] > 'B'))
|
||||
m_pageBasic->m_Edit_Dpi.SetParams(100, 600, 10);
|
||||
if ((m_hardwareVersion[5] == 'C' && atoi(m_hardwareVersion.substr(6, 4).c_str()) >= 103) || (m_hardwareVersion[5] > 'C'))
|
||||
m_pageBasic->GetDlgItem(IDC_CKCOLORCAST)->ShowWindow(SW_SHOW);
|
||||
else
|
||||
{
|
||||
((CButton*)m_pageBasic->GetDlgItem(IDC_CKCOLORCAST))->SetCheck(FALSE);
|
||||
m_pageBasic->GetDlgItem(IDC_CKCOLORCAST)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setvisable_dogear(false);
|
||||
|
@ -248,6 +255,7 @@ void CTwainUI::UpdateUI()
|
|||
((CButton*)m_pageBasic->GetDlgItem(IDC_RDSPEEDPRIORITY))->SetCheck(!settings->is_high_imagequality);
|
||||
((CButton*)m_pageBasic->GetDlgItem(IDC_CKSPLIT))->SetCheck(settings->is_split);
|
||||
((CButton*)m_pageBasic->GetDlgItem(IDC_CKFIXEDPAPER))->SetCheck(settings->en_fixedpaper);
|
||||
((CButton*)m_pageBasic->GetDlgItem(IDC_CKCOLORCAST))->SetCheck(settings->pixtype == 2?settings->is_colorcast : FALSE);
|
||||
#ifdef UV
|
||||
m_pageBasic->m_bUV = settings->hardwarecaps.en_uv == 1 ? TRUE : FALSE;
|
||||
#endif
|
||||
|
@ -612,6 +620,7 @@ void CTwainUI::UpDateScanParam(PCONFIGPARAMS configItem, bool updateDs)
|
|||
settings->resolution_dst = configItem->Resolution;
|
||||
settings->resolution_native = 200.0f;
|
||||
settings->is_split = ((CButton*)m_pageBasic->GetDlgItem(IDC_CKSPLIT))->GetCheck();
|
||||
settings->is_colorcast = ((CButton*)m_pageBasic->GetDlgItem(IDC_CKCOLORCAST))->GetCheck();
|
||||
settings->is_switchfrontback = configItem->EnSwitchFrontBack ? 1 : 0;
|
||||
//float value_Contrast = GetContrast(configItem->Contrast);
|
||||
settings->contrast = configItem->Contrast;
|
||||
|
|
|
@ -367,6 +367,7 @@ void GScanO1003399::config_params(GScanCap& param)
|
|||
param39.fillholeratio_down = param.fillholeratio_down;
|
||||
param39.fillholeratio_left = param.fillholeratio_left;
|
||||
param39.fillholeratio_right = param.fillholeratio_right;
|
||||
param39.is_colorcast = param.is_colorcast;
|
||||
param39.fillhole.fillholeratio = std::max(std::max(std::max(param.fillholeratio_down, param.fillholeratio_up), std::max(param.fillholeratio_left, param.fillholeratio_right)),1);
|
||||
m_usb->write_bulk(¶m39, sizeof(param39));
|
||||
m_param .resolution_native = param.resolution_dst >= 500.0f ? 300.0f : 200.0f;
|
||||
|
@ -618,7 +619,7 @@ void GScanO1003399::usb_run()
|
|||
void GScanO1003399::start()
|
||||
{
|
||||
|
||||
if ((fwversion[5] == 'B' && atoi(fwversion.substr(6, 4).c_str()) >= 1030) || (fwversion[5] > 'B')) {
|
||||
if ((fwversion[5] == 'B' && atoi(fwversion.substr(6, 4).c_str()) >= 500) || (fwversion[5] > 'B')) {
|
||||
if (scanner_read_reg(m_usb, SR_GET_LOCK_STATES)) {
|
||||
std::string keys;
|
||||
if (m_token.length() != 32)
|
||||
|
|
|
@ -257,6 +257,7 @@ std::string GScanO400Android::GetMacAdder() {
|
|||
|
||||
std::string GScanO400Android::GetFWVersion()
|
||||
{
|
||||
//return "1234567890";
|
||||
if (m_usb.get() && m_usb->is_connected()) {
|
||||
//lock_guard< mutex> lock(m_imgLocker);
|
||||
if (fwVersion.empty()) {
|
||||
|
@ -268,10 +269,6 @@ std::string GScanO400Android::GetFWVersion()
|
|||
m_usb->read_bulk(&fwVersion[0], fwVersion.size());
|
||||
std::this_thread::sleep_for(chrono::milliseconds(10));
|
||||
}
|
||||
//if (fwVersion.substr(0, 2) == "G3" || fwVersion.substr(0, 2) == "G4" ||fwVersion.substr(0,2)== "GU")
|
||||
// is_Android = false;
|
||||
//else
|
||||
// is_Android = true;
|
||||
return fwVersion;
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -203,7 +203,7 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
|||
// m_iaList.push_back(shared_ptr<CImageApplyHSVCorrect>(new CImageApplyHSVCorrect(CImageApplyHSVCorrect::CorrectOption::LowSaturation_Removal, true)));
|
||||
//}
|
||||
|
||||
if (param.pixtype == 2)
|
||||
if ((param.pixtype == 2) && (param.is_colorcast))
|
||||
{
|
||||
m_iaList.push_back(m_colorcast);
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ const std::string AUTOCROP = "bAuotCrop";
|
|||
const std::string HIGH_IMAGE_QUALITY = "bHighimagequality";
|
||||
const std::string SWITCHFRONTBACK = "bSwitchFrontBack";
|
||||
const std::string SPLIT = "bSplit";
|
||||
const std::string COLORCAST = "bColorCast";
|
||||
|
||||
//<!亮度对比度选项卡
|
||||
const std::string AUTOCONTRAST = "bAutoContrast";
|
||||
|
@ -302,6 +303,7 @@ struct GScanCap
|
|||
bool en_fillholeratio_right;
|
||||
int autopaper_timeout;
|
||||
int hsvFilter;
|
||||
bool is_colorcast; /**< 色偏使能*/
|
||||
std::string Caption;
|
||||
std::string SavePath;
|
||||
};
|
||||
|
@ -384,9 +386,10 @@ struct GScanCap_3399
|
|||
int fillholeratio_down;
|
||||
int fillholeratio_left;
|
||||
int fillholeratio_right;
|
||||
std::uint8_t fold_concatmode; /*Æ´½Óģʽ*/
|
||||
std::uint8_t fold_concatmode; /**< 拼接模式>*/
|
||||
int HsvFilterType; /**< 答题卡留红除杂色功能类型 暂定0 为关闭;1为留红除杂色>*/
|
||||
uint32_t reserve[1024]; /**< Ô¤Áô4096×Ö½Ú×öÐÒéÀ©Õ¹*/
|
||||
bool is_colorcast; /**< 色偏校正>*/
|
||||
uint32_t reserve[1024]; /**< 预留4096字节做协议扩展>*/
|
||||
};
|
||||
|
||||
typedef struct Paper_Status {
|
||||
|
|
|
@ -108,6 +108,7 @@ void GscanJsonConfig::SaveGscanCapConfig(const GScanCap & gcap, const std::strin
|
|||
outJson["Config"].Add(FLOD, (bool)(gcap.en_fold), false);
|
||||
outJson["Config"].Add(SWITCHFRONTBACK, (bool)(gcap.is_switchfrontback), false);
|
||||
outJson["Config"].Add(SPLIT, gcap.is_split, false);
|
||||
outJson["Config"].Add(COLORCAST, gcap.is_colorcast, false);
|
||||
|
||||
#ifdef UV
|
||||
outJson["Config"].Add(ENUVMODEL, (bool)(gcap.hardwarecaps.en_uv), false);
|
||||
|
@ -261,6 +262,8 @@ void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const
|
|||
root["Config"][FLOD].Add(i, (bool)cfgArray[i].en_fold);
|
||||
root["Config"][SWITCHFRONTBACK].Add(i,(bool)cfgArray[i].is_switchfrontback);
|
||||
root["Config"][SPLIT].Add(i, cfgArray[i].is_split);
|
||||
root["Config"][COLORCAST].Add(i, cfgArray[i].is_colorcast);
|
||||
|
||||
#ifdef UV
|
||||
root["Config"][ENUVMODEL].Add(i, cfgArray[i].hardwarecaps.en_uv);
|
||||
#endif
|
||||
|
@ -448,6 +451,9 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
|||
neb::CJsonObject itmEnSplit;
|
||||
root["Config"].Get(SPLIT, itmEnSplit);
|
||||
|
||||
neb::CJsonObject itmEnColorCast;
|
||||
root["Config"].Get(COLORCAST, itmEnColorCast);
|
||||
|
||||
neb::CJsonObject itmdiscarbrank_value;
|
||||
root["Config"].Get(DISCARBLANK_VALUE, itmdiscarbrank_value);
|
||||
#ifdef UV
|
||||
|
@ -603,6 +609,9 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
|||
cfp.en_fold = b_value ? 1 : 0;
|
||||
itmEnSwitchFrontBack.Get(i, b_value);
|
||||
cfp.is_switchfrontback = b_value ? 1 : 0;
|
||||
itmEnColorCast.Get(i, b_value);
|
||||
cfp.is_colorcast = b_value ? 1 : 0;
|
||||
|
||||
itmEnSplit.Get(i, b_value);
|
||||
cfp.is_split = b_value ? 1 : 0;
|
||||
#ifdef UV
|
||||
|
@ -757,6 +766,9 @@ std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str
|
|||
cfp.is_switchfrontback = bvalue?1:0;
|
||||
root["Config"].Get(SPLIT, bvalue);
|
||||
cfp.is_split = bvalue ? 1 : 0;
|
||||
|
||||
root["Config"].Get(COLORCAST, bvalue);
|
||||
cfp.is_colorcast = bvalue ? 1 : 0;
|
||||
#ifdef UV
|
||||
root["Config"].Get(ENUVMODEL, bvalue);
|
||||
cfp.hardwarecaps.en_uv = bvalue ? 1 : 0;
|
||||
|
@ -908,6 +920,7 @@ json GscanJsonConfig::GscancapToJson(GScanCap& cap)
|
|||
js[CONFIG][FLOD] = cap.en_fold;
|
||||
js[CONFIG][SWITCHFRONTBACK] = cap.is_switchfrontback;
|
||||
js[CONFIG][SPLIT] = cap.is_split;
|
||||
js[CONFIG][COLORCAST] = cap.is_colorcast;
|
||||
#ifdef UV
|
||||
js[CONFIG][ENUVMODEL] = cap.hardwarecaps.en_uv;
|
||||
#endif
|
||||
|
@ -985,6 +998,7 @@ GScanCap GscanJsonConfig::JsonToGscancap(json& js)
|
|||
cap.en_fold = json_cast(js[CONFIG][FLOD]).to_int();
|
||||
cap.is_switchfrontback = json_cast(js[CONFIG][SWITCHFRONTBACK]).to_int();
|
||||
cap.is_split = json_cast(js[CONFIG][SPLIT]).to_int();
|
||||
cap.is_colorcast = json_cast(js[CONFIG][COLORCAST]).to_int();
|
||||
#ifdef UV
|
||||
cap.hardwarecaps.en_uv = json_cast(js[CONFIG][ENUVMODEL]).to_int();
|
||||
#endif // UV
|
||||
|
@ -1062,6 +1076,7 @@ json GscanJsonConfig::GetDefaultJson()
|
|||
"bFlod": false ,
|
||||
"bSwitchFrontBack": false ,
|
||||
"bSplit": false ,
|
||||
"bColorCast": false ,
|
||||
"bUVmodel": false,
|
||||
"detachnoise": false ,
|
||||
"detachnoisevalue": 10 ,
|
||||
|
@ -1133,6 +1148,7 @@ json GscanJsonConfig::GetDefaultJson()
|
|||
"bFlod": false ,
|
||||
"bSwitchFrontBack": false ,
|
||||
"bSplit": false ,
|
||||
"bColorCast": false ,
|
||||
"detachnoise": false ,
|
||||
"detachnoisevalue": 10 ,
|
||||
"bfadeback": false ,
|
||||
|
|
|
@ -11,7 +11,7 @@ CImageApplyColorCastCorrect::CImageApplyColorCastCorrect()
|
|||
{
|
||||
std::vector<double> points_x, points_y;
|
||||
points_x = { 0, 80, 175, 255 };
|
||||
points_y = { 12, 85, 175, 270 };
|
||||
points_y = { 5, 85, 170, 245 };
|
||||
createTable(points_x, points_y);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ enum class CapTypeEx : unsigned short {
|
|||
TwEx_IFixedPaper = 0x8114,
|
||||
TwEx_IHighImageQuality = 0x8115,
|
||||
TwEx_SETTOKEN = 0x8116,
|
||||
TwEx_IHsvFilter = 0x8117
|
||||
TwEx_IHsvFilter = 0x8117,
|
||||
TwEx_ColorCast = 0x8118,
|
||||
};
|
||||
|
||||
enum class PaperSizeEx : unsigned short {
|
||||
|
@ -2302,7 +2303,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
//ͼÏñ²ð·Ö
|
||||
m_query[(CapType)(CapTypeEx::TwEx_ImageSplit)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_ImageSplit)] = [this](Msg msg, Capability& data)->Result {
|
||||
CapabilityPrintf(msg, enum2str(CapTypeEx::TwEx_CropModel), msg == Msg::Set ? to_string((float)data.currentItem<UInt32>()) : "");
|
||||
CapabilityPrintf(msg, enum2str(CapTypeEx::TwEx_ImageSplit), msg == Msg::Set ? to_string((float)data.currentItem<Bool>()) : "");
|
||||
if (Msg::Set == msg) {
|
||||
auto mech = data.currentItem<Bool>();
|
||||
m_scanparam->is_split = mech;
|
||||
|
@ -2311,9 +2312,23 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
|
|||
return CapSupGetAllResetEx<bool, Bool, (CapType)CapTypeEx::TwEx_ImageSplit>(msg, data, m_scanparam->is_split, false);
|
||||
};
|
||||
|
||||
//ɫƫУÕý
|
||||
m_query[(CapType)(CapTypeEx::TwEx_ColorCast)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_ColorCast)] = [this](Msg msg, Capability& data)->Result {
|
||||
CapabilityPrintf(msg, enum2str(CapTypeEx::TwEx_ColorCast), msg == Msg::Set ? to_string((float)data.currentItem<Bool>()) : "");
|
||||
if (Msg::Set == msg) {
|
||||
if (m_scanparam->pixtype != 2)
|
||||
return badValue();
|
||||
auto mech = data.currentItem<Bool>();
|
||||
m_scanparam->is_colorcast = mech;
|
||||
return success();
|
||||
}
|
||||
return CapSupGetAllResetEx<bool, Bool, (CapType)CapTypeEx::TwEx_ColorCast>(msg, data, m_scanparam->is_colorcast, false);
|
||||
};
|
||||
|
||||
m_query[(CapType)(CapTypeEx::TwEx_IHsvFilter)] = msgSupportGetAllSetReset;
|
||||
m_caps[(CapType)(CapTypeEx::TwEx_IHsvFilter)] = [this](Msg msg, Capability& data)->Result {
|
||||
//CapabilityPrintf(msg, enum2str(CapTypeEx::TwEx_CropModel), msg == Msg::Set ? to_string((float)data.currentItem<UInt32>()) : "");
|
||||
CapabilityPrintf(msg, enum2str(CapTypeEx::TwEx_IHsvFilter), msg == Msg::Set ? to_string((float)data.currentItem<Bool>()) : "");
|
||||
if (Msg::Set == msg) {
|
||||
auto mech = data.currentItem<Bool>();
|
||||
if (m_scanparam->pixtype != 2)//color
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
huagao/stdafx.h
BIN
huagao/stdafx.h
Binary file not shown.
Loading…
Reference in New Issue