mirror of http://192.168.1.51:8099/lmh188/twain3.0
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
/*
|
||
* ====================================================
|
||
|
||
* 功能:空白页识别。
|
||
* 作者:刘丁维
|
||
* 生成时间: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版本导致计算结果存在差异的代码。
|
||
* 版本号:v1.3.1
|
||
|
||
* ====================================================
|
||
*/
|
||
|
||
#ifndef IMAGE_APPLY_DISCARD_BLANK_H
|
||
#define IMAGE_APPLY_DISCARD_BLANK_H
|
||
|
||
#include "ImageApply.h"
|
||
|
||
class CImageApplyDiscardBlank : public CImageApply
|
||
{
|
||
public:
|
||
CImageApplyDiscardBlank();
|
||
|
||
CImageApplyDiscardBlank(int blockSize, int devTh);
|
||
|
||
/*
|
||
* isnormal [in]:true标准模式,false为票据复写纸模式
|
||
* */
|
||
CImageApplyDiscardBlank(bool isnormal);
|
||
|
||
virtual ~CImageApplyDiscardBlank(void);
|
||
|
||
virtual void apply(cv::Mat& pDib, int side);
|
||
|
||
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
|
||
|
||
void setIntensity(int val);
|
||
|
||
void setMinArea(int val) { m_dSize = val; }
|
||
|
||
static bool apply(const cv::Mat& pDib, int blockSize = 200, int devTh = 15);
|
||
|
||
private:
|
||
|
||
static int processRectR(const cv::Mat& image, cv::RotatedRect& rotatedRect, std::vector<cv::Point>& maxContour,
|
||
double scale, double thresh, int blobAreaSize);
|
||
|
||
static bool scalar_LE(const cv::Scalar& val1, const cv::Scalar& val2);
|
||
|
||
static cv::Mat getRoiMat(const cv::Mat& pDib);
|
||
private:
|
||
bool m_res;
|
||
bool m_isNormalDiscard;
|
||
int m_dSize;
|
||
cv::Scalar m_devTh;
|
||
};
|
||
|
||
#endif // !IMAGE_APPLY_DISCARD_BLANK_H
|