tx-gxx-linux/device/gxx-linux/imgproc/CSizedetect.h

41 lines
1.6 KiB
C
Raw Permalink Normal View History

2023-04-08 00:56:20 +00:00
#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}},
2023-05-02 01:50:55 +00:00
{PaperSize::G400_B4,HGSize{1969,2780}},
2023-04-08 00:56:20 +00:00
{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}},
2023-05-02 01:50:55 +00:00
{PaperSize::G400_LETTER,HGSize{1700,2198}},
{PaperSize::G400_LETTERR,HGSize{2198,1700}},
2023-04-08 00:56:20 +00:00
{PaperSize::G400_LONGLETTER,HGSize{2040,2640}},
2023-05-02 01:50:55 +00:00
{PaperSize::G400_MAXSIZE,HGSize{2338,8189}}
2023-04-08 00:56:20 +00:00
};
};