twain3.0/huagao/ImageProcess/ImageApplyDiscardBlank.h

56 lines
1.4 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]
* 版本号v1.1
* ====================================================
*/
#ifndef IMAGE_APPLY_DISCARD_BLANK_H
#define IMAGE_APPLY_DISCARD_BLANK_H
#include "ImageApply.h"
class CImageApplyDiscardBlank : public CImageApply
{
public:
CImageApplyDiscardBlank(int blockSize, int devTh);
/*
* isnormal [in]:true标准模式false为票据复写纸模式
* */
CImageApplyDiscardBlank();
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