twain3.0/huagao/ImageProcess/ImageApplyDiscardBlank.h

51 lines
1.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* ====================================================
* 功能:空白页识别。
* 作者:刘丁维
* 生成时间2020/4/21
* 最近修改时间2020/4/21 v1.0
2020/8/12 v1.1 开放setIntensity和setMinArea取消isNormal标识位扩大setIntensity的设置范围从[2, 20]扩大到[1, 100]
2020/8/25 v1.1.1 纸张检测缩进从100像素调整到20像素
2020/10/16 v1.2 添加新接口,能够高效便捷判断图片是否为空白页
2020/10/19 v1.2.1 修复静态空白页判断识别误判的BUG
2021/04/13 v1.3.0 增加标准/票据标识位
2021/08/12 v1.3.1 添加防止不同opencv版本导致计算结果存在差异的代码。
2021/12/14 v1.3.2 重构算法。
2021/12/15 v1.3.3 微调参数。
2021/12/17 v1.3.4 增加背景色接口,实现对纯色纸张的空白页判定
2022/09/07 v1.3.5 修复部分参数传递的BUG
2022/09/19 v1.4 增加模糊处理,提高空白页的过滤能力
2022/09/19 v1.4.1 调整模糊处理步骤
* 版本号v1.4.1
* ====================================================
*/
#ifndef IMAGE_APPLY_DISCARD_BLANK_H
#define IMAGE_APPLY_DISCARD_BLANK_H
#include "ImageApply.h"
class CImageApplyDiscardBlank : public CImageApply
{
public:
CImageApplyDiscardBlank(double threshold = 40, int edge = 150, double devTh = 50, double meanTh = 200);
virtual ~CImageApplyDiscardBlank(void);
virtual void apply(cv::Mat& pDib, int side);
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
static bool apply(const cv::Mat& pDib, double threshold = 40, int edge = 150, double devTh = 50, double meanTh = 200);
private:
double m_threshold;
int m_edge;
double m_devTh;
double m_meanTh;
};
#endif // !IMAGE_APPLY_DISCARD_BLANK_H