41 lines
1.6 KiB
C++
41 lines
1.6 KiB
C++
#pragma once
|
|
#include "IPreproc.h"
|
|
#include <map>
|
|
#include "commondef.h"
|
|
|
|
class CSizedetect : public IPreproc
|
|
{
|
|
public:
|
|
explicit CSizedetect(int papaertype);
|
|
virtual ~CSizedetect(void);
|
|
virtual int preprocess(cv::Mat& mat,void* unused);
|
|
void SetPapertype(int papertype);
|
|
private:
|
|
void rotate(float& x, float& y, float angle);
|
|
void minAeaRect(const float* x, const float* y, int size, float& width, float& height);
|
|
void fastMeasureSize(const unsigned char* data, int src_width, int src_height, int channels, float& dst_width, float& dst_height, int threshold = 40, int indent = 20, int step = 5);
|
|
private:
|
|
int m_papertype;
|
|
int m_horThre;
|
|
int m_verThre;
|
|
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_LETTERR,HGSize{2198,1700}},
|
|
{PaperSize::G400_LONGLETTER,HGSize{2040,2640}},
|
|
{PaperSize::G400_MAXSIZE,HGSize{2338,8189}}
|
|
};
|
|
}; |