code_device/hgdriver/ImageProcess/ImageApplySizeDetection.h

85 lines
1.9 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.

/*
* ====================================================
* 功能:尺寸检测
* 作者:刘丁维
* 生成时间2022/05/11
* 最近修改时间2022/05/11
* 版本号v1.0
* ====================================================
*/
#ifndef IMAGE_APPLY_SIZE_DETECTION_H
#define IMAGE_APPLY_SIZE_DETECTION_H
#include "ImageApply.h"
#include <map>
class CImageApplySizeDetection
{
public:
enum PaperSize
{
G400_A3,
G400_A4,
G400_A4R,
G400_A5,
G400_A5R,
G400_A6,
G400_A6R,
G400_B4,
G400_B5,
G400_B5R,
G400_B6R,
G400_B6,
G400_DOUBLELETTER,
G400_LEGAL,
G400_LETTER,
G400_LONGLETTER,
G400_MAXSIZE
};
struct HGSize
{
int width;
int height;
};
public:
CImageApplySizeDetection(int paperType, int thre_x = 70, int thre_y = 80);
~CImageApplySizeDetection();
virtual int apply(const cv::Mat& pDib);
inline void setPaperType(int paperType) { m_paperType = paperType; }
private:
int m_paperType;
int m_thre_x;
int m_thre_y;
std::map<PaperSize, HGSize> m_supportPaper = {
{PaperSize::G400_A3,HGSize{2338,3307}},
{PaperSize::G400_A4,HGSize{1653,2338}},
{PaperSize::G400_A4R,HGSize{2338,1653}},
{PaperSize::G400_A5,HGSize{1165,1653}},
{PaperSize::G400_A5R,HGSize{1653,1165}},
{PaperSize::G400_A6,HGSize{826,1165}},
{PaperSize::G400_A6R,HGSize{1165,826}},
{PaperSize::G400_B4,HGSize{1969,2780}},
{PaperSize::G400_B5,HGSize{1385,1968}},
{PaperSize::G400_B5R,HGSize{1968,1385}},
{PaperSize::G400_B6R,HGSize{1433,1007}},
{PaperSize::G400_B6,HGSize{1007,1433}},
{PaperSize::G400_DOUBLELETTER,HGSize{2200,3400}},
{PaperSize::G400_LEGAL,HGSize{1700,2800}},
{PaperSize::G400_LETTER,HGSize{1700,2198}},
{PaperSize::G400_LONGLETTER,HGSize{2040,2640}},
{PaperSize::G400_MAXSIZE,HGSize{2338,6614}}
};
};
#endif // !IMAGE_APPLY_SIZE_DETECTION_H