mirror of http://192.168.1.51:8099/lmh188/twain3.0
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
/*
|
||
* ====================================================
|
||
|
||
* 功能:折角检测。检测原理:计算纸张的理论四角顶点,到实际轮廓最小距离。当任意顶点到轮廓最小距离超过阈值,则判定为折角
|
||
* 作者:刘丁维
|
||
* 生成时间:2020/10/30
|
||
* 最近修改时间:2020/10/30
|
||
* 版本号:v1.0
|
||
|
||
* ====================================================
|
||
*/
|
||
|
||
#ifndef IMAGE_APPLY_DOGEAR_DETECTION_H
|
||
#define IMAGE_APPLY_DOGEAR_DETECTION_H
|
||
|
||
#include "ImageApply.h"
|
||
|
||
class CImageApplyDogEarDetection :public CImageApply
|
||
{
|
||
public:
|
||
|
||
/// <summary>
|
||
/// 折角检测默认构造函数,threshold = 40, zoom = 1.0, distance = 50
|
||
/// </summary>
|
||
CImageApplyDogEarDetection();
|
||
|
||
/// <summary>
|
||
/// 折角检测构造函数
|
||
/// </summary>
|
||
/// <param name="threshlod">二值化阈值</param>
|
||
/// <param name="zoom">原图缩放比例,对于大尺寸图像而言通过zoom缩小图像可减少计算量。默认值1.0(不缩放)</param>
|
||
/// <param name="distance">理论顶点到实际轮廓最小距离的阈值,大于该阈值则判定为折角,默认值50(像素)</param>
|
||
CImageApplyDogEarDetection(double threshlod, double zoom = 1.0, double distance = 50);
|
||
|
||
virtual ~CImageApplyDogEarDetection(void);
|
||
|
||
/// <summary>
|
||
/// 获取检测结果。该函数须在调用apply之后使用。
|
||
/// </summary>
|
||
/// <returns>true为折角,false为不折角</returns>
|
||
inline bool getResult() { return m_result; }
|
||
|
||
virtual void apply(cv::Mat& pDib, int side);
|
||
|
||
private:
|
||
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
|
||
|
||
private:
|
||
double m_threshold;
|
||
double m_zoom;
|
||
double m_distance;
|
||
|
||
bool m_result;
|
||
};
|
||
|
||
#endif // IMAGE_APPLY_DOGEAR_DETECTION_H
|