更新渗透算法,调整纸张尺寸
This commit is contained in:
parent
e7db4bdf16
commit
93a39d30ac
|
@ -1,89 +1,21 @@
|
|||
#include "ImageApplyRefuseInflow.h"
|
||||
#include "ImageApplyAdjustColors.h"
|
||||
|
||||
static unsigned char table_very_light[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
||||
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
|
||||
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
|
||||
100, 101, 102, 103, 104, 105, 106, 107, 138, 139,
|
||||
140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
||||
150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
|
||||
170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
||||
180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
||||
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
||||
200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
|
||||
210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
||||
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
|
||||
250, 251, 252, 253, 254, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255 };
|
||||
CImageApplyRefuseInflow::CImageApplyRefuseInflow(int constrast)
|
||||
: m_adjustColor(new CImageApplyAdjustColors(0, constrast, 1.0f))
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned char table_light[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
||||
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
|
||||
90, 91, 92, 93, 94, 95, 96, 97, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
|
||||
170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
||||
180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
||||
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
||||
200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
|
||||
210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
||||
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
|
||||
250, 251, 252, 253, 254, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255 };
|
||||
CImageApplyRefuseInflow::~CImageApplyRefuseInflow()
|
||||
{
|
||||
delete m_adjustColor;
|
||||
}
|
||||
|
||||
static unsigned char table_medium[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
||||
70, 71, 72, 73, 74, 75, 76, 77, 178, 179,
|
||||
180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
||||
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
||||
200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
|
||||
210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
||||
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
|
||||
250, 251, 252, 253, 254, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255 };
|
||||
|
||||
static unsigned char table_strong[] = {
|
||||
void CImageApplyRefuseInflow::apply(cv::Mat& pDib, int side)
|
||||
{
|
||||
(void)side;
|
||||
#if 0
|
||||
static unsigned char table_contrast[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -110,71 +42,11 @@ static unsigned char table_strong[] = {
|
|||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255 };
|
||||
|
||||
static unsigned char table_very_strong[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 33, 34, 35, 36, 37, 218, 219,
|
||||
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
|
||||
250, 251, 252, 253, 254, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255 };
|
||||
|
||||
CImageApplyRefuseInflow::CImageApplyRefuseInflow(int level)
|
||||
{
|
||||
m_level = level;
|
||||
}
|
||||
|
||||
CImageApplyRefuseInflow::~CImageApplyRefuseInflow()
|
||||
{
|
||||
}
|
||||
|
||||
void CImageApplyRefuseInflow::apply(cv::Mat& pDib, int side)
|
||||
{
|
||||
(void)side;
|
||||
static cv::Mat mat_table;
|
||||
switch(m_level)
|
||||
{
|
||||
case 1:
|
||||
mat_table = cv::Mat(1, 256, CV_8UC1, table_very_light);
|
||||
break;
|
||||
case 2:
|
||||
mat_table = cv::Mat(1, 256, CV_8UC1, table_light);
|
||||
break;
|
||||
case 3:
|
||||
mat_table = cv::Mat(1, 256, CV_8UC1, table_medium);
|
||||
break;
|
||||
case 4:
|
||||
mat_table = cv::Mat(1, 256, CV_8UC1, table_strong);
|
||||
break;
|
||||
case 5:
|
||||
mat_table = cv::Mat(1, 256, CV_8UC1, table_very_strong);
|
||||
break;
|
||||
default:
|
||||
mat_table = cv::Mat(1, 256, CV_8UC1, table_medium);
|
||||
break;
|
||||
}
|
||||
|
||||
static cv::Mat mat_table(1, 256, CV_8UC1, table_contrast);
|
||||
cv::LUT(pDib, mat_table, pDib);
|
||||
#else
|
||||
m_adjustColor->apply(pDib, side);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CImageApplyRefuseInflow::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/*
|
||||
* ====================================================
|
||||
|
||||
* „1¤7„1¤7„1¤7<EFBFBD>1ť1„1¤7„1¤7„1¤7„1¤7„1¤7<EFBFBD>0Č6„1¤7„1¤7<EFBFBD>0č9„1¤7„1¤7<EFBFBD>0Ë2„1¤7<EFBFBD>0»2„1¤7
|
||||
* „1¤7„1¤7„1¤7<EFBFBD>1°3„1¤7„1¤7„1¤7„1¤7„1¤7<EFBFBD>0Ë4
|
||||
* „1¤7„1¤7„1¤7„1¤7<EFBFBD>0µ2„1¤7‚4Ź22020/4/21
|
||||
* „1¤7„1¤7„1¤7„1¤7<EFBFBD>1¬0„1¤7<EFBFBD>0µ2„1¤7‚4Ź22020/4/21
|
||||
* „1¤7·Ú„1¤7<EFBFBD>0•0„1¤7v1.0
|
||||
* 功能:防渗透。
|
||||
* 作者:刘丁维
|
||||
* 生成时间:2020/4/21
|
||||
* 最近修改时间:v1.0 2020/04/21
|
||||
* v1.1 2022/05/04 重构算法,采用提高对比度实现防渗透。
|
||||
* 版本号:v1.1
|
||||
|
||||
* ====================================================
|
||||
*/
|
||||
|
@ -15,10 +16,11 @@
|
|||
|
||||
#include "ImageApply.h"
|
||||
|
||||
class CImageApplyAdjustColors;
|
||||
class CImageApplyRefuseInflow : public CImageApply
|
||||
{
|
||||
public:
|
||||
CImageApplyRefuseInflow(int level);
|
||||
CImageApplyRefuseInflow(int constrast = 15);
|
||||
|
||||
virtual ~CImageApplyRefuseInflow();
|
||||
|
||||
|
@ -27,6 +29,6 @@ public:
|
|||
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
|
||||
|
||||
private:
|
||||
int m_level = 3;
|
||||
CImageApplyAdjustColors* m_adjustColor;
|
||||
};
|
||||
#endif // !IMAGE_APPLY_REFUSE_INFLOW_H
|
||||
|
|
|
@ -4,7 +4,7 @@ using namespace std;
|
|||
|
||||
namespace Device {
|
||||
|
||||
PaperSize::PaperSize()
|
||||
PaperSize::PaperSize(int pid):pid_(pid)
|
||||
{
|
||||
InitPaperMap();
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ namespace Device {
|
|||
else
|
||||
papersize.insert({ MaxSize,SIZE{297,420 * 2} });
|
||||
|
||||
|
||||
if(pid_ == 0x300)
|
||||
papersize.insert({ USStatement,SIZE{210,(long)(297 * 1.5)} });
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue