mirror of http://192.168.1.51:8099/lmh188/twain3.0
调整配置类以适应新的GScanCap;
This commit is contained in:
parent
169dab7d5c
commit
a3af24ceab
|
@ -3,16 +3,23 @@
|
||||||
G400ScanConfig::G400ScanConfig(GScanCap& gcap)
|
G400ScanConfig::G400ScanConfig(GScanCap& gcap)
|
||||||
{
|
{
|
||||||
cfg.params.doubleFeeded = gcap.hardwarecaps.en_doublefeed == 0 ? 0 : 1;
|
cfg.params.doubleFeeded = gcap.hardwarecaps.en_doublefeed == 0 ? 0 : 1;
|
||||||
cfg.params.dpi = gcap.resolution_dst <= 200.0f ? G400_DPI::G400_D200 : (gcap.resolution_dst <= 300.0f ? G400_DPI::G400_D300 : G400_DPI::G400_D600);
|
cfg.params.dpi = G400_DPI::G400_D200;//gcap.resolution_dst <= 200.0f ? G400_DPI::G400_D200 : (gcap.resolution_dst <= 300.0f ? G400_DPI::G400_D300 : G400_DPI::G400_D600);
|
||||||
cfg.params.enableLed = 1;
|
cfg.params.enableLed = 1;
|
||||||
if (gcap.filter != 3 || gcap.enhance_color)
|
if (gcap.filter != 3 || gcap.enhance_color)
|
||||||
cfg.params.isColor = 1;
|
cfg.params.isColor = 1;
|
||||||
else
|
else
|
||||||
cfg.params.isColor = SupPixelTypes[gcap.pixtype];
|
cfg.params.isColor = SupPixelTypes[gcap.pixtype];
|
||||||
cfg.params.enableStable = gcap.hardwarecaps.en_stapledetect==0?0:1;
|
cfg.params.enableStable = 0;//gcap.hardwarecaps.en_stapledetect==0?0:1;
|
||||||
cfg.params.isCorrect = 1;
|
cfg.params.isCorrect = 1;//1 »úÆ÷УÕý
|
||||||
PaperStatus ps = { gcap.papertype,gcap.paperAlign };
|
PaperStatus ps = { gcap.papertype,gcap.paperAlign };
|
||||||
cfg.params.pageSize = SupPaperTyps[ps];
|
cfg.params.pageSize = SupPaperTyps[ps];
|
||||||
|
CSize size;
|
||||||
|
#ifdef G300
|
||||||
|
size = PaperSize.GetPaperSize(TwSS::A4, 200.0f, gcap.paperAlign);//G300 ×î´óÖ§³ÖA4·ùÃæ
|
||||||
|
#else
|
||||||
|
size = PaperSize.GetPaperSize(gcap.papertype, 200.0f, gcap.paperAlign);
|
||||||
|
#endif// G300
|
||||||
|
cfg.params.dstHeight = (int)((size.cy+200)/100);
|
||||||
cfg.params.reversed1 = cfg.params.reversed2 = 0;
|
cfg.params.reversed1 = cfg.params.reversed2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Device/IConfig.h"
|
#include "Device/IConfig.h"
|
||||||
#include "Device/PublicFunc.h"
|
#include "Device/PublicFunc.h"
|
||||||
|
#include "Device/PaperSize.h"
|
||||||
|
|
||||||
class G400ScanConfig :
|
class G400ScanConfig :
|
||||||
public IConfig
|
public IConfig
|
||||||
{
|
{
|
||||||
|
@ -17,7 +19,8 @@ public:
|
||||||
unsigned int enableLed : 1;
|
unsigned int enableLed : 1;
|
||||||
unsigned int reversed1 : 6;
|
unsigned int reversed1 : 6;
|
||||||
unsigned int isCorrect : 1;
|
unsigned int isCorrect : 1;
|
||||||
unsigned int reversed2 : 14;
|
unsigned int dstHeight : 8;
|
||||||
|
unsigned int reversed2 : 6;
|
||||||
}params;
|
}params;
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
};
|
};
|
||||||
|
@ -26,5 +29,6 @@ public:
|
||||||
virtual unsigned int GetData() override;
|
virtual unsigned int GetData() override;
|
||||||
private:
|
private:
|
||||||
Configuration cfg;
|
Configuration cfg;
|
||||||
|
Device::PaperSize PaperSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -351,7 +351,7 @@ void GDevice::Int_main()
|
||||||
{
|
{
|
||||||
//0x3fe ==>b 1111 1111 10 异常位高有效时
|
//0x3fe ==>b 1111 1111 10 异常位高有效时
|
||||||
if (ms->value & 0x3fe) {
|
if (ms->value & 0x3fe) {
|
||||||
((GScan200*)m_eventcall_userdata)->set_scan_status(false);
|
//((GScan200*)m_eventcall_userdata)->set_scan_status(false);
|
||||||
event_call(ms->value, m_eventcall_userdata);
|
event_call(ms->value, m_eventcall_userdata);
|
||||||
m_run = false;
|
m_run = false;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void GDevice::Int_main()
|
||||||
int ret = get_option(Cam_Options::scanner_scan_status);
|
int ret = get_option(Cam_Options::scanner_scan_status);
|
||||||
if (m_run&&!ret)//电机板工作中
|
if (m_run&&!ret)//电机板工作中
|
||||||
{
|
{
|
||||||
((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止
|
//((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止
|
||||||
m_run = false;
|
m_run = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ static std::map<PaperStatus, unsigned int> SupPaperTyps = {
|
||||||
{{TwSS::USStatement,PaperAlign::Rot0},16},
|
{{TwSS::USStatement,PaperAlign::Rot0},16},
|
||||||
{{TwSS::MaxSize,PaperAlign::Rot0},16}
|
{{TwSS::MaxSize,PaperAlign::Rot0},16}
|
||||||
#else
|
#else
|
||||||
{ {TwSS::A3,PaperAlign::Rot0},G400_A3},
|
{{TwSS::A3,PaperAlign::Rot0},G400_A3},
|
||||||
{{TwSS::A4,PaperAlign::Rot0},G400_A4},
|
{{TwSS::A4,PaperAlign::Rot0},G400_A4},
|
||||||
{{TwSS::A4,PaperAlign::Rot270},G400_A4R},
|
{{TwSS::A4,PaperAlign::Rot270},G400_A4R},
|
||||||
{{TwSS::A5,PaperAlign::Rot0 },G400_A5},
|
{{TwSS::A5,PaperAlign::Rot0 },G400_A5},
|
||||||
|
@ -43,6 +43,11 @@ static std::map<PaperStatus, unsigned int> SupPaperTyps = {
|
||||||
{{TwSS::USLetter,PaperAlign::Rot270},G400_LETTERR},
|
{{TwSS::USLetter,PaperAlign::Rot270},G400_LETTERR},
|
||||||
{{TwSS::USLedger,PaperAlign::Rot0},G400_DOUBLELETTER},
|
{{TwSS::USLedger,PaperAlign::Rot0},G400_DOUBLELETTER},
|
||||||
{{TwSS::USLegal,PaperAlign::Rot0},G400_LEGAL},
|
{{TwSS::USLegal,PaperAlign::Rot0},G400_LEGAL},
|
||||||
|
#ifdef G300
|
||||||
|
{{TwSS::None,PaperAlign::Rot0},G400_A4},
|
||||||
|
#else // G300
|
||||||
|
{{TwSS::None,PaperAlign::Rot0},G400_A3},
|
||||||
|
#endif
|
||||||
{{TwSS::MaxSize,PaperAlign::Rot0},G400_LONGLETTER},
|
{{TwSS::MaxSize,PaperAlign::Rot0},G400_LONGLETTER},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -80,16 +85,9 @@ typedef union Config_Param {
|
||||||
unsigned int stable_enbale : 1;
|
unsigned int stable_enbale : 1;
|
||||||
unsigned int screw_detect_enable : 1;
|
unsigned int screw_detect_enable : 1;
|
||||||
unsigned int screw_detect_level : 3;//µÚÊ®ËÄλ
|
unsigned int screw_detect_level : 3;//µÚÊ®ËÄλ
|
||||||
#ifdef G200
|
|
||||||
|
|
||||||
unsigned int unused_one : 6;
|
unsigned int unused_one : 6;
|
||||||
unsigned int pc_correct : 1;
|
unsigned int pc_correct : 1;
|
||||||
unsigned int unused_two : 11;
|
unsigned int unused_two : 11;
|
||||||
#else // G200
|
|
||||||
unsigned int unused_one : 3;
|
|
||||||
unsigned int correct_enable : 1;
|
|
||||||
unsigned int unused_two : 14;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
} ConfigParam;
|
} ConfigParam;
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ float ImageMatQueue::getdpi()
|
||||||
void ImageMatQueue::updatefixratio(float& hratio, float& vratio)
|
void ImageMatQueue::updatefixratio(float& hratio, float& vratio)
|
||||||
{
|
{
|
||||||
if (hratio > 0.80f && hratio < 1.2f && vratio >0.80f && vratio < 1.2f) {
|
if (hratio > 0.80f && hratio < 1.2f && vratio >0.80f && vratio < 1.2f) {
|
||||||
fx = hratio;
|
this->fx = hratio;
|
||||||
fy = vratio;
|
this->fy = vratio;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -123,8 +123,19 @@ void ImageMatQueue::clear()
|
||||||
void ImageMatQueue::setparam(const GScanCap& param)
|
void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
{
|
{
|
||||||
scanParam = param;
|
scanParam = param;
|
||||||
m_iaList.clear();
|
scanParam.is_duplex = 0;
|
||||||
|
scanParam.imageRotateDegree = 90.0f;
|
||||||
|
#ifdef DEBUG
|
||||||
|
string outinfo = "autodescrew : " + to_string(scanParam.autodescrew) + "\n brightness : " + to_string(scanParam.brightness) + "\n contrast " + to_string(scanParam.contrast) + "\n enhance_color : " + to_string(scanParam.enhance_color) + "\n en_fold: " + to_string(scanParam.en_fold)
|
||||||
|
+ "\n fillbackground : " + to_string(scanParam.fillbackground) + "\n is_fillhole : " + to_string(scanParam.fillhole.is_fillhole) + "\n fillholeratio : " + to_string(scanParam.fillhole.fillholeratio) + "\n filter : " + to_string(scanParam.filter) + "\n gamma : " + to_string(scanParam.gamma)
|
||||||
|
+ "\n imageRotateDegree : " + to_string(scanParam.imageRotateDegree) + "\n is_autocrop : " + to_string(scanParam.is_autocrop) + "\n is_autodiscradblank_normal : " + to_string(scanParam.is_autodiscradblank_normal) + "\n is_autodiscradblank_vince : " + to_string(scanParam.is_autodiscradblank_vince)
|
||||||
|
+ "\n is_autotext : " + to_string(scanParam.is_autotext) + "\n is_backrotate180 : " + to_string(scanParam.is_backrotate180) + "\n is_duplex : " + to_string(scanParam.is_duplex) + "\n is_switchfrontback : " + to_string(scanParam.is_switchfrontback) + "\n multi_output_red : " + to_string(scanParam.multi_output_red)
|
||||||
|
+ "\n paperAlign : " + to_string(scanParam.paperAlign) + "\n papertype : " + to_string(scanParam.papertype) + "\n resolution_dst : " + to_string(scanParam.resolution_dst) + "\n scannum : " + to_string(scanParam.scannum) + "\n sharpen : " + to_string(scanParam.sharpen)+
|
||||||
|
"Pixtype : "+to_string(scanParam.pixtype);
|
||||||
|
FileTools::write_log("2.txt", outinfo);
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
m_iaList.clear();
|
||||||
if (scanParam.fillhole.is_fillhole) {
|
if (scanParam.fillhole.is_fillhole) {
|
||||||
float ratio = scanParam.fillhole.fillholeratio / 100.0;
|
float ratio = scanParam.fillhole.fillholeratio / 100.0;
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageOutHole(200, ratio, 50)));
|
m_iaList.push_back(shared_ptr<CImageApply>(new CImageOutHole(200, ratio, 50)));
|
||||||
|
@ -148,8 +159,6 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank(param.is_autodiscradblank_normal ? true : false)));
|
m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank(param.is_autodiscradblank_normal ? true : false)));
|
||||||
//m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank(param.areanum,param.devnmax)));
|
//m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyDiscardBlank(param.areanum,param.devnmax)));
|
||||||
}
|
}
|
||||||
//if (param.pixtype != 0) //sharpen
|
|
||||||
// m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplySharpen()));
|
|
||||||
|
|
||||||
//filter 0 r 1 g 2 b 3 none enhance color 0 none 1 r 2 g 3 b
|
//filter 0 r 1 g 2 b 3 none enhance color 0 none 1 r 2 g 3 b
|
||||||
if (param.filter != 3 || param.enhance_color) {
|
if (param.filter != 3 || param.enhance_color) {
|
||||||
|
@ -182,7 +191,7 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
if (param.papertype == TwSS::USStatement)
|
if (param.papertype == TwSS::USStatement)
|
||||||
islongcustomcrop = true;
|
islongcustomcrop = true;
|
||||||
if (param.is_autocrop || islongcustomcrop) {
|
if (param.is_autocrop || islongcustomcrop) {
|
||||||
double ratio = param.resolution_dst / param.resolution_native;
|
double ratio = param.resolution_dst / 200.0;//
|
||||||
apply = new CImageApplyResize(CImageApplyResize::ResizeType::RATIO, cv::Size(0, 0), ratio, ratio);
|
apply = new CImageApplyResize(CImageApplyResize::ResizeType::RATIO, cv::Size(0, 0), ratio, ratio);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -223,11 +232,6 @@ void ImageMatQueue::setparam(const GScanCap& param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageMatQueue::EnqueueBmpBuffer(std::vector<unsigned char>& bmpdata)
|
|
||||||
{
|
|
||||||
//std::lock_guard<std::mutex> lock(m_Locker);
|
|
||||||
//m_imagedata.Put(bmpdata);
|
|
||||||
}
|
|
||||||
void ImageMatQueue::EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>> bmpdata)
|
void ImageMatQueue::EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>> bmpdata)
|
||||||
{
|
{
|
||||||
m_imagedata.Put(bmpdata);
|
m_imagedata.Put(bmpdata);
|
||||||
|
@ -242,6 +246,11 @@ bool ImageMatQueue::empty()
|
||||||
return atm_orgin_image_remains == 0 && m_imagedata.Size() == 0 && !is_scanning;
|
return atm_orgin_image_remains == 0 && m_imagedata.Size() == 0 && !is_scanning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImageMatQueue::queuesempty()
|
||||||
|
{
|
||||||
|
return atm_orgin_image_remains == 0 && m_imagedata.Size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int index = 0;
|
static int index = 0;
|
||||||
void ImageMatQueue::proc()
|
void ImageMatQueue::proc()
|
||||||
{
|
{
|
||||||
|
@ -259,7 +268,6 @@ void ImageMatQueue::proc()
|
||||||
auto buffs = m_rawBuffs.Take()->getImageBuffs();
|
auto buffs = m_rawBuffs.Take()->getImageBuffs();
|
||||||
if (!m_rawBuffs.IsShutDown() && !buffs.empty()) {
|
if (!m_rawBuffs.IsShutDown() && !buffs.empty()) {
|
||||||
vector<cv::Mat> mats;
|
vector<cv::Mat> mats;
|
||||||
int k = 0;
|
|
||||||
for (auto& buf : buffs) {
|
for (auto& buf : buffs) {
|
||||||
ImreadModes rm;
|
ImreadModes rm;
|
||||||
|
|
||||||
|
@ -269,7 +277,10 @@ void ImageMatQueue::proc()
|
||||||
rm = scanParam.pixtype == 2 ? IMREAD_COLOR : IMREAD_GRAYSCALE;
|
rm = scanParam.pixtype == 2 ? IMREAD_COLOR : IMREAD_GRAYSCALE;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//StopWatch sw;
|
||||||
cv::Mat mat = cv::imdecode(*buf, rm);
|
cv::Mat mat = cv::imdecode(*buf, rm);
|
||||||
|
//double epl= sw.elapsed_ms();
|
||||||
|
//FileTools::write_log("1.txt", to_string(epl)+" img index"+to_string(++index));
|
||||||
buf.reset();
|
buf.reset();
|
||||||
if (mat.empty()) {
|
if (mat.empty()) {
|
||||||
writelog("decode image data error");
|
writelog("decode image data error");
|
||||||
|
@ -280,8 +291,13 @@ void ImageMatQueue::proc()
|
||||||
mat.release();
|
mat.release();
|
||||||
#else // G200
|
#else // G200
|
||||||
//resize(mat, mat, cv::Size(), 1.001, 1.0070);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动
|
//resize(mat, mat, cv::Size(), 1.001, 1.0070);//用于修正与佳能机器幅面大小不匹配问题 此系数请勿轻易动
|
||||||
|
//cv::imwrite("D:\\org"+to_string(index)+".jpg", mat);
|
||||||
Mat front = mat(Rect(0, 0, mat.cols / 2, mat.rows));
|
Mat front = mat(Rect(0, 0, mat.cols / 2, mat.rows));
|
||||||
Mat back = mat(Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows));
|
Mat back = mat(Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows));
|
||||||
|
if (scanParam.imageRotateDegree != 0.0&&scanParam.imageRotateDegree!=180.0) {
|
||||||
|
cv::flip(front, front, 0);
|
||||||
|
cv::flip(front, front, 1);
|
||||||
|
}
|
||||||
mats.push_back(front);
|
mats.push_back(front);
|
||||||
mats.push_back(back);
|
mats.push_back(back);
|
||||||
#endif
|
#endif
|
||||||
|
@ -294,9 +310,15 @@ void ImageMatQueue::proc()
|
||||||
}
|
}
|
||||||
buffs.clear();
|
buffs.clear();
|
||||||
|
|
||||||
|
if (scanParam.is_switchfrontback)
|
||||||
|
swap(mats[0], mats[1]);
|
||||||
|
//StopWatch sw;
|
||||||
for (int j = 0; j < m_iaList.size(); j++) {
|
for (int j = 0; j < m_iaList.size(); j++) {
|
||||||
m_iaList[j]->apply(mats, scanParam.is_duplex);
|
m_iaList[j]->apply(mats, scanParam.is_duplex);
|
||||||
|
//FileTools::write_log("E:\\Users\\huago\\Desktop\\3.txt", "image proc "+std::to_string(j)+" time eplsed: " + std::to_string(sw.elapsed_ms()));
|
||||||
|
//sw.reset();
|
||||||
}
|
}
|
||||||
|
//FileTools::write_log("E:\\Users\\huago\\Desktop\\2.txt", "image proc time eplsed: " + std::to_string(sw.elapsed_ms()));
|
||||||
|
|
||||||
for (int i = 0; i < mats.size(); i++) {
|
for (int i = 0; i < mats.size(); i++) {
|
||||||
if (!scanParam.is_duplex && i == 1) {
|
if (!scanParam.is_duplex && i == 1) {
|
||||||
|
@ -307,7 +329,6 @@ void ImageMatQueue::proc()
|
||||||
IMat2Bmp idata;
|
IMat2Bmp idata;
|
||||||
idata = scanParam.pixtype == 0 ? (IMat2Bmp)Mat2BmpBw(mats[i], scanParam.resolution_dst) : Mat2Bmp(mats[i], scanParam.resolution_dst);
|
idata = scanParam.pixtype == 0 ? (IMat2Bmp)Mat2BmpBw(mats[i], scanParam.resolution_dst) : Mat2Bmp(mats[i], scanParam.resolution_dst);
|
||||||
auto data = idata.getBmpDataBuffer();
|
auto data = idata.getBmpDataBuffer();
|
||||||
//mats[i].release();
|
|
||||||
EnqueueBmpBuffer(data);
|
EnqueueBmpBuffer(data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -315,7 +336,7 @@ void ImageMatQueue::proc()
|
||||||
writelog("enqueue image is empty " + std::to_string(index++));
|
writelog("enqueue image is empty " + std::to_string(index++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//FileTools::write_log("E:\\Users\\huago\\Desktop\\2.txt", "image output time eplsed: " + std::to_string(sw.elapsed_ms()));
|
||||||
if (scanParam.multi_output_red) {
|
if (scanParam.multi_output_red) {
|
||||||
for (int i = 0; i < mats.size(); i++) {
|
for (int i = 0; i < mats.size(); i++) {
|
||||||
if (!mats[i].empty()) {
|
if (!mats[i].empty()) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "BlockingQueue.h"
|
#include "BlockingQueue.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "PaperSize.h"
|
#include "PaperSize.h"
|
||||||
|
#include "filetools.h"
|
||||||
|
|
||||||
class IMat2Bmp {
|
class IMat2Bmp {
|
||||||
public:
|
public:
|
||||||
|
@ -156,6 +156,7 @@ public:
|
||||||
void pushMat(std::shared_ptr<IDecode> buf);
|
void pushMat(std::shared_ptr<IDecode> buf);
|
||||||
std::shared_ptr<std::vector<unsigned char>> popBmpdata();
|
std::shared_ptr<std::vector<unsigned char>> popBmpdata();
|
||||||
bool empty();
|
bool empty();
|
||||||
|
bool queuesempty();
|
||||||
bool valid();
|
bool valid();
|
||||||
void clear();
|
void clear();
|
||||||
void setparam(const GScanCap& param);
|
void setparam(const GScanCap& param);
|
||||||
|
@ -166,7 +167,6 @@ public:
|
||||||
void updatefixratio(float& hratio, float& vratio);
|
void updatefixratio(float& hratio, float& vratio);
|
||||||
private:
|
private:
|
||||||
void proc();
|
void proc();
|
||||||
void EnqueueBmpBuffer(std::vector<unsigned char>& bmpdata);
|
|
||||||
void EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>>);
|
void EnqueueBmpBuffer(std::shared_ptr<std::vector<unsigned char>>);
|
||||||
void PaniusCount();
|
void PaniusCount();
|
||||||
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>>m_imagedata;
|
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>>m_imagedata;
|
||||||
|
|
|
@ -34,6 +34,7 @@ void JsonConfig::WriteToJson(PCONFIGPARAMS pConfigItem,const std::string fileNam
|
||||||
outJson["Config"].Add(DB_AREANUM, (int)(pConfigItem->DBlank_AreaNum));
|
outJson["Config"].Add(DB_AREANUM, (int)(pConfigItem->DBlank_AreaNum));
|
||||||
outJson["Config"].Add(DB_DEVNMAX, (int)(pConfigItem->DBlank_DevnMax));
|
outJson["Config"].Add(DB_DEVNMAX, (int)(pConfigItem->DBlank_DevnMax));
|
||||||
outJson["Config"].Add(FLOD, (bool)(pConfigItem->EnFlod),false);
|
outJson["Config"].Add(FLOD, (bool)(pConfigItem->EnFlod),false);
|
||||||
|
outJson["Config"].Add(SWITCHFRONTBACK, (bool)(pConfigItem->EnSwitchFrontBack), false);
|
||||||
|
|
||||||
outJson["Config"].Add(BRIGHTNESS,(float)(pConfigItem->Brightness));
|
outJson["Config"].Add(BRIGHTNESS,(float)(pConfigItem->Brightness));
|
||||||
outJson["Config"].Add(AUTOCONTRAST,(bool)(pConfigItem->EnAutoContrast),false);
|
outJson["Config"].Add(AUTOCONTRAST,(bool)(pConfigItem->EnAutoContrast),false);
|
||||||
|
@ -97,6 +98,7 @@ void JsonConfig::WriteJsonArrayToFile(std::vector<CONFIGPARAMS> cfgArray,const s
|
||||||
root["Config"].AddEmptySubArray(DB_AREANUM);
|
root["Config"].AddEmptySubArray(DB_AREANUM);
|
||||||
root["Config"].AddEmptySubArray(DB_DEVNMAX);
|
root["Config"].AddEmptySubArray(DB_DEVNMAX);
|
||||||
root["Config"].AddEmptySubArray(FLOD);
|
root["Config"].AddEmptySubArray(FLOD);
|
||||||
|
root["Config"].AddEmptySubArray(SWITCHFRONTBACK);
|
||||||
|
|
||||||
root["Config"].AddEmptySubArray(BRIGHTNESS);
|
root["Config"].AddEmptySubArray(BRIGHTNESS);
|
||||||
root["Config"].AddEmptySubArray(AUTOCONTRAST);
|
root["Config"].AddEmptySubArray(AUTOCONTRAST);
|
||||||
|
@ -133,6 +135,7 @@ void JsonConfig::WriteJsonArrayToFile(std::vector<CONFIGPARAMS> cfgArray,const s
|
||||||
root["Config"][DB_AREANUM].Add(cfgArray[i].DBlank_AreaNum);
|
root["Config"][DB_AREANUM].Add(cfgArray[i].DBlank_AreaNum);
|
||||||
root["Config"][DB_DEVNMAX].Add(cfgArray[i].DBlank_DevnMax);
|
root["Config"][DB_DEVNMAX].Add(cfgArray[i].DBlank_DevnMax);
|
||||||
root["Config"][FLOD].Add(i,cfgArray[i].EnFlod);
|
root["Config"][FLOD].Add(i,cfgArray[i].EnFlod);
|
||||||
|
root["Config"][SWITCHFRONTBACK].Add(i, cfgArray[i].EnSwitchFrontBack);
|
||||||
|
|
||||||
root["Config"][BRIGHTNESS].Add(cfgArray[i].Brightness);
|
root["Config"][BRIGHTNESS].Add(cfgArray[i].Brightness);
|
||||||
root["Config"][AUTOCONTRAST].Add(i,cfgArray[i].EnAutoContrast);
|
root["Config"][AUTOCONTRAST].Add(i,cfgArray[i].EnAutoContrast);
|
||||||
|
@ -245,6 +248,7 @@ CONFIGPARAMS JsonConfig::GetDefaultConfigParams()
|
||||||
params.DBlank_AreaNum = 8;
|
params.DBlank_AreaNum = 8;
|
||||||
params.DBlank_DevnMax = 200;
|
params.DBlank_DevnMax = 200;
|
||||||
params.EnFlod = FALSE;
|
params.EnFlod = FALSE;
|
||||||
|
params.EnSwitchFrontBack = FALSE;
|
||||||
|
|
||||||
params.Brightness=0.0f;//ÁÁ¶È
|
params.Brightness=0.0f;//ÁÁ¶È
|
||||||
params.EnAutoContrast=FALSE;//×Ô¶¯¶Ô±È¶È
|
params.EnAutoContrast=FALSE;//×Ô¶¯¶Ô±È¶È
|
||||||
|
@ -274,7 +278,6 @@ std::vector<CONFIGPARAMS> JsonConfig::parseJsonFromString(const std::string str)
|
||||||
|
|
||||||
neb::CJsonObject root(str);
|
neb::CJsonObject root(str);
|
||||||
vector<CONFIGPARAMS> vcConfig;
|
vector<CONFIGPARAMS> vcConfig;
|
||||||
|
|
||||||
int size=0;
|
int size=0;
|
||||||
neb::CJsonObject itmPaparSize;
|
neb::CJsonObject itmPaparSize;
|
||||||
root["Config"].Get(PAPARSIZE,itmPaparSize);
|
root["Config"].Get(PAPARSIZE,itmPaparSize);
|
||||||
|
@ -299,7 +302,8 @@ std::vector<CONFIGPARAMS> JsonConfig::parseJsonFromString(const std::string str)
|
||||||
root["Config"].Get(DB_DEVNMAX, itmDBDevnMax);
|
root["Config"].Get(DB_DEVNMAX, itmDBDevnMax);
|
||||||
neb::CJsonObject itmEnFlod;
|
neb::CJsonObject itmEnFlod;
|
||||||
root["Config"].Get(FLOD, itmEnFlod);
|
root["Config"].Get(FLOD, itmEnFlod);
|
||||||
|
neb::CJsonObject itmEnSwitchFrontBack;
|
||||||
|
root["Config"].Get(SWITCHFRONTBACK, itmEnSwitchFrontBack);
|
||||||
|
|
||||||
neb::CJsonObject itmBrtnes;
|
neb::CJsonObject itmBrtnes;
|
||||||
root["Config"].Get(BRIGHTNESS,itmBrtnes);
|
root["Config"].Get(BRIGHTNESS,itmBrtnes);
|
||||||
|
@ -378,6 +382,8 @@ std::vector<CONFIGPARAMS> JsonConfig::parseJsonFromString(const std::string str)
|
||||||
cfp.DBlank_DevnMax = i_value;
|
cfp.DBlank_DevnMax = i_value;
|
||||||
itmEnFlod.Get(i, b_value);
|
itmEnFlod.Get(i, b_value);
|
||||||
cfp.EnFlod = b_value;
|
cfp.EnFlod = b_value;
|
||||||
|
itmEnSwitchFrontBack.Get(i, b_value);
|
||||||
|
cfp.EnSwitchFrontBack = b_value;
|
||||||
|
|
||||||
itmBrtnes.Get(i, i_value);
|
itmBrtnes.Get(i, i_value);
|
||||||
cfp.Brightness= i_value;
|
cfp.Brightness= i_value;
|
||||||
|
@ -458,6 +464,8 @@ std::vector<CONFIGPARAMS> JsonConfig::parseJsonFromString(const std::string str)
|
||||||
cfp.DBlank_DevnMax = index;
|
cfp.DBlank_DevnMax = index;
|
||||||
root["Config"].Get(FLOD, bvalue);
|
root["Config"].Get(FLOD, bvalue);
|
||||||
cfp.EnFlod = bvalue;
|
cfp.EnFlod = bvalue;
|
||||||
|
root["Config"].Get(SWITCHFRONTBACK, bvalue);
|
||||||
|
cfp.EnSwitchFrontBack = bvalue;
|
||||||
|
|
||||||
root["Config"].Get(BRIGHTNESS,index);
|
root["Config"].Get(BRIGHTNESS,index);
|
||||||
cfp.Brightness=index;
|
cfp.Brightness=index;
|
||||||
|
|
|
@ -197,6 +197,8 @@ char* THCAR2char(TCHAR* tchStr)
|
||||||
return chRtn;
|
return chRtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CTwainUI 消息处理程序
|
||||||
|
|
||||||
BOOL CheckAndCreateFileDir(TCHAR* p_file_path, BOOL flg)
|
BOOL CheckAndCreateFileDir(TCHAR* p_file_path, BOOL flg)
|
||||||
{
|
{
|
||||||
TCHAR szTmp[MAX_PATH] = { 0 };
|
TCHAR szTmp[MAX_PATH] = { 0 };
|
||||||
|
|
|
@ -22,6 +22,7 @@ using namespace std;
|
||||||
//<!基本选项卡
|
//<!基本选项卡
|
||||||
#define PIXTYPE "iPixType"
|
#define PIXTYPE "iPixType"
|
||||||
#define PAPARSIZE "iPaparSize"
|
#define PAPARSIZE "iPaparSize"
|
||||||
|
#define PAPERALIGN "iPaperAlign"
|
||||||
#define RESOLUTION "iResolution"
|
#define RESOLUTION "iResolution"
|
||||||
#define DUPLEX "iDuplex"
|
#define DUPLEX "iDuplex"
|
||||||
#define DISCARBLANK "bDiscardBlank"
|
#define DISCARBLANK "bDiscardBlank"
|
||||||
|
@ -30,6 +31,7 @@ using namespace std;
|
||||||
#define DB_DEVNMAX "iDevnMax"
|
#define DB_DEVNMAX "iDevnMax"
|
||||||
#define FLOD "bFlod"
|
#define FLOD "bFlod"
|
||||||
#define AUTOCROP "bAuotCrop"
|
#define AUTOCROP "bAuotCrop"
|
||||||
|
#define SWITCHFRONTBACK "bSwitchFrontBack"
|
||||||
|
|
||||||
|
|
||||||
//<!亮度对比度选项卡
|
//<!亮度对比度选项卡
|
||||||
|
@ -41,6 +43,7 @@ using namespace std;
|
||||||
|
|
||||||
//<!图像处理选项卡
|
//<!图像处理选项卡
|
||||||
#define FILTERTYPE "iFilter"
|
#define FILTERTYPE "iFilter"
|
||||||
|
#define ENHANCECOLOR "iEnhance"
|
||||||
#define SHARPENTYPE "iSharpen"
|
#define SHARPENTYPE "iSharpen"
|
||||||
#define FILLBLACK "bFillBlcak"
|
#define FILLBLACK "bFillBlcak"
|
||||||
#define AUTODESCREW "bAutoDescrew"
|
#define AUTODESCREW "bAutoDescrew"
|
||||||
|
@ -53,6 +56,7 @@ using namespace std;
|
||||||
#define BINDINGDETECT "bBindingDetect"
|
#define BINDINGDETECT "bBindingDetect"
|
||||||
#define SCANCOUNT "ScanCount"
|
#define SCANCOUNT "ScanCount"
|
||||||
#define DOCORIENTATION "bOrientation"
|
#define DOCORIENTATION "bOrientation"
|
||||||
|
#define AUTO_TEXT "bAutoText"
|
||||||
#define BACKROTATE180 "iBackRotate180"
|
#define BACKROTATE180 "iBackRotate180"
|
||||||
#define SCREWDETECT "bScrewDetect"
|
#define SCREWDETECT "bScrewDetect"
|
||||||
#define SCREWLEVEL "iScrewLevel"
|
#define SCREWLEVEL "iScrewLevel"
|
||||||
|
@ -76,6 +80,7 @@ typedef struct tagCONFIGPARAMS
|
||||||
int DBlank_AreaNum;
|
int DBlank_AreaNum;
|
||||||
int DBlank_DevnMax;
|
int DBlank_DevnMax;
|
||||||
bool EnFlod;
|
bool EnFlod;
|
||||||
|
bool EnSwitchFrontBack;
|
||||||
/*亮度对比度选项卡参数*/
|
/*亮度对比度选项卡参数*/
|
||||||
float Brightness;
|
float Brightness;
|
||||||
bool EnAutoContrast;
|
bool EnAutoContrast;
|
||||||
|
@ -163,7 +168,7 @@ struct GScanCap
|
||||||
byte is_duplex; /**< True to use duplex false for simplex, ignored if flatbed*/
|
byte is_duplex; /**< True to use duplex false for simplex, ignored if flatbed*/
|
||||||
byte en_fold;
|
byte en_fold;
|
||||||
int pixtype; /**< type of pixels to transfer image as */
|
int pixtype; /**< type of pixels to transfer image as */
|
||||||
ScanRect scanrect;
|
//ScanRect scanrect;
|
||||||
float resolution_dst; /**< horizontal resolution */
|
float resolution_dst; /**< horizontal resolution */
|
||||||
float resolution_native;
|
float resolution_native;
|
||||||
float gamma; /**< Gamma */
|
float gamma; /**< Gamma */
|
||||||
|
@ -174,6 +179,7 @@ struct GScanCap
|
||||||
byte is_autocrop; /**< 自动裁切*/
|
byte is_autocrop; /**< 自动裁切*/
|
||||||
byte is_autodiscradblank_normal; /**< 自动丢弃空白页通用*/
|
byte is_autodiscradblank_normal; /**< 自动丢弃空白页通用*/
|
||||||
byte is_autodiscradblank_vince;/**自动丢弃空白页发票*/
|
byte is_autodiscradblank_vince;/**自动丢弃空白页发票*/
|
||||||
|
byte is_switchfrontback; /**交换正反面*/
|
||||||
byte autodescrew; /**< 自动纠偏*/
|
byte autodescrew; /**< 自动纠偏*/
|
||||||
byte multi_output_red; /*多流输出*/
|
byte multi_output_red; /*多流输出*/
|
||||||
byte filter; /**< 除色*/
|
byte filter; /**< 除色*/
|
||||||
|
@ -184,10 +190,14 @@ struct GScanCap
|
||||||
byte is_backrotate180; /**< 背面旋转180*/
|
byte is_backrotate180; /**< 背面旋转180*/
|
||||||
HardwareCaps hardwarecaps; /**< 硬件扫描参数*/
|
HardwareCaps hardwarecaps; /**< 硬件扫描参数*/
|
||||||
FillHole fillhole;
|
FillHole fillhole;
|
||||||
bool is_autotext; /**< 自动文本方向识别*/
|
byte is_autotext; /**< 自动文本方向识别*/
|
||||||
|
std::string Caption;
|
||||||
|
std::string SavePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct Paper_Status {
|
typedef struct Paper_Status {
|
||||||
|
Paper_Status(unsigned int paper, unsigned int orentate) :Paper(paper), Orentate(orentate) {}
|
||||||
|
Paper_Status():Paper(0), Orentate(0){}
|
||||||
unsigned int Paper;
|
unsigned int Paper;
|
||||||
unsigned int Orentate;
|
unsigned int Orentate;
|
||||||
friend bool operator<(const struct Paper_Status& a, const struct Paper_Status& b) {
|
friend bool operator<(const struct Paper_Status& a, const struct Paper_Status& b) {
|
||||||
|
|
|
@ -18,10 +18,10 @@ public:
|
||||||
|
|
||||||
static void write_log(std::string filename, std::string log)
|
static void write_log(std::string filename, std::string log)
|
||||||
{
|
{
|
||||||
std::string savepath;
|
//std::string savepath;
|
||||||
std::string str = "D:";
|
//std::string str = "D:";
|
||||||
savepath = str+"\\"+filename;
|
//savepath = str+"\\"+filename;
|
||||||
std::ofstream ofs(savepath, std::ios::app);
|
std::ofstream ofs(filename, std::ios::app);
|
||||||
|
|
||||||
time_t timp;
|
time_t timp;
|
||||||
struct tm* p;
|
struct tm* p;
|
||||||
|
|
|
@ -7,18 +7,21 @@ hgConfigClass::hgConfigClass(GScanCap param)
|
||||||
m_param = { 0 };
|
m_param = { 0 };
|
||||||
PaperStatus ps = { param.papertype,param.paperAlign };
|
PaperStatus ps = { param.papertype,param.paperAlign };
|
||||||
m_param.paper = ContainspaperTypesKey(ps) ? SupPaperTyps[ps] : 0;
|
m_param.paper = ContainspaperTypesKey(ps) ? SupPaperTyps[ps] : 0;
|
||||||
m_param.color = ContainsPixTypeKey(param.hardwarecaps.capturepixtype) ? SupPixelTypes[param.hardwarecaps.capturepixtype] : 2;
|
if(param.filter!=3||param.enhance_color!=0)
|
||||||
m_param.dpi = ContainsResolutionKey(param.resolution_native) ? SupResolutions[param.resolution_native] :
|
m_param.color = 1;//color
|
||||||
m_param.double_feed_enbale = param.hardwarecaps.en_doublefeed;
|
else
|
||||||
m_param.stable_enbale = param.hardwarecaps.en_stapledetect;
|
{
|
||||||
m_param.screw_detect_enable = param.hardwarecaps.en_skrewdetect;
|
m_param.color = ContainsPixTypeKey(param.pixtype) ? SupPixelTypes[param.pixtype] : 2;
|
||||||
m_param.screw_detect_level = m_param.screw_detect_enable? secrewMaps[param.hardwarecaps.skrewdetectlevel]:0;
|
|
||||||
|
}
|
||||||
|
m_param.dpi = ContainsResolutionKey(param.resolution_native) ? SupResolutions[param.resolution_native] : 1;
|
||||||
|
m_param.double_feed_enbale = (unsigned int)param.hardwarecaps.en_doublefeed;
|
||||||
|
m_param.stable_enbale =(unsigned int) param.hardwarecaps.en_stapledetect;
|
||||||
|
m_param.screw_detect_enable = (unsigned int)param.hardwarecaps.en_skrewdetect;
|
||||||
|
m_param.screw_detect_level = (unsigned int)m_param.screw_detect_enable? secrewMaps[param.hardwarecaps.skrewdetectlevel]:0;
|
||||||
#ifdef G200
|
#ifdef G200
|
||||||
m_param.pc_correct = 0;
|
m_param.pc_correct = 0;
|
||||||
#else // G200
|
|
||||||
m_param.correct_enable = 1;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_param.unused_one = m_param.unused_two = 0;
|
m_param.unused_one = m_param.unused_two = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue