#pragma once
|
|
|
|
#include <list>
|
#include <iostream>
|
#include <math.h>
|
#include<Windows.h>
|
#include <opencv2/opencv.hpp>
|
#include <opencv2/highgui.hpp>
|
#include <opencv2/core.hpp>
|
#include <opencv2/imgcodecs.hpp>
|
#ifndef _IMGDIVIDER_INCLUDE_
|
#define _IMGDIVIDER_INCLUDE_
|
#include "ImgDivider.h"
|
#endif
|
|
#include "RecognitionUtil.h"
|
|
#include "win32_screen_shots.h"
|
|
#ifndef _NUMBER_L2_WIDTH
|
#define _NUMBER_L2_WIDTH 5
|
#endif
|
|
#ifndef _NUMBER_L2_HEIGHT
|
#define _NUMBER_L2_HEIGHT 8
|
#endif
|
|
#ifndef _NUMBER_L2_TOTAL_NUMBER
|
#define _NUMBER_L2_TOTAL_NUMBER 19
|
#endif
|
|
|
#ifndef _NUMBER_GP_CODE_WIDTH
|
#define _NUMBER_GP_CODE_WIDTH 6
|
#endif
|
|
#ifndef _NUMBER_GP_CODE_HEIGHT
|
#define _NUMBER_GP_CODE_HEIGHT 10
|
#endif
|
|
#ifndef _NUMBER_GP_CODE_TOTAL_NUMBER
|
#define _NUMBER_GP_CODE_TOTAL_NUMBER 6
|
#endif
|
|
#ifndef _IMG_BINARY_THRESHOLD
|
#define _IMG_BINARY_THRESHOLD 64
|
#endif
|
|
|
using namespace std;
|
class ImgUtil
|
{
|
public:
|
static NumberData NUMS_LEVEL2[10];
|
static NumberData NUMS_GP_CODE[10];
|
|
|
//Êý×Ö£¨0-9£©Ò»Î¬Êý¾Ý
|
static uchar* numsOneLevel_level2;
|
static uchar* numsOneLevel_gpcode;
|
|
|
private:
|
//·Ö¸ôʱ¼ä
|
static list<cv::Mat> splitTime(cv::Mat img) throw(string);
|
//·Ö¸ôСÊý£¬ÖмäµÄ¿ÕMat±íʾСÊýµã
|
static list<cv::Mat> splitDecimal(cv::Mat img) throw(string);
|
|
//½«0-9µÄÊý×ÖͼƬ×ö¸ñʽ»¯
|
static cv::Mat formatNumLevel2(cv::Mat num) throw(string);
|
|
|
|
public:
|
|
static void init();
|
|
//·Ö¸ôͼƬ
|
static list<int*> divideImg(cv::Mat img);
|
|
|
static list<int*> divideImg(cv::Mat img,bool save);
|
|
|
/*
|
* ·Ö¸ôÿһÐеÄÊý×ÖÊý¾Ý£¬¸ñʽΪxx:xx:xx xxxx.xx xxxxx
|
*
|
*/
|
static void splitRowNumDataForOpenCL(cv::Mat img, list<int*> data, unsigned char* result, int rowIndex) throw(string);
|
|
//ͼƬ»Ò¶È
|
static cv::Mat grayImage(cv::Mat src);
|
|
//¹¹½¨Ä£°åÊý¾Ý£¬ÓÃÓÚopencl¾ØÕóÔËËãÖеÄÊý×Öʶ±ð
|
static uchar* createTemplateNumData(int lines);
|
|
static bool isImgSame(cv::Mat m1, cv::Mat m2);
|
|
//·Ö¸ôÕûÊý
|
static list<cv::Mat> splitNum(cv::Mat img) throw(string);
|
|
static list<cv::Mat> splitNum(cv::Mat img,int threshold_value) throw(string);
|
|
static cv::Mat formatNumGPCode(cv::Mat num) throw(string);
|
};
|