#pragma once #include #include #include #include #include "ImgUtil.h" enum SplitType { NUM_TYPE_TIME, NUM_TYPE_MONEY, NUM_TYPE_PRICE, NUM_TYPE_CODE, NUM_TYPE_NUM, NUM_TYPE_PERCENT, NUM_TYPE_NUM_SHOU, }; struct IntDataInfo { int* data; int length; }; struct UcharDataInfo { uchar* data; int length; }; class OpenCLExcuter { private: cl_int error; cl_uint num_of_platforms = 0; cl_platform_id platforms; cl_device_id devices; cl_context context; FILE* program_handle; size_t program_size; char* program_buffer; cl_program program; size_t log_size; char* program_log; cl_kernel kernel; cl_command_queue queue; //ÖØÐ´´½¨¶ÓÁÐ void reCreateQueue(); //Ö´Ðгö´í void excuteError(); public: static string rootPath; void init(); void destory(); //½«RGBͼƬתΪ»Ò¶ÈͼƬ void rgb2Gray(cv::Mat img, unsigned char* result); //½«RGBAͼƬתΪ»Ò¶ÈͼƬ void rgba2Gray(cv::Mat img, unsigned char* result); //½«RGBͼƬ·´×ª¶þÖµ»¯»Ò¶ÈͼƬ void rgb2ThresholdInvert(unsigned char* imgs, int imgWidth, int imgHeight, unsigned char* result, int threadhold); //½«RGBAͼƬ·´×ª¶þÖµ»¯»Ò¶ÈͼƬ void rgba2ThresholdInvert(unsigned char* imgs, int imgWidth, int imgHeight, unsigned char* result, int threadhold); //´´½¨Ê¶±ðµÄÊý×ÖÄ£°å void createNumberTemplates(int lines, int num_width, int num_height, int num_count, uchar* numsOneLevelData, unsigned char* result); // ʶ±ðÊý×Ö£ºÊ¶±ðµÄ¹æÔòΪdataÊý¾ÝÓënum_templates×ö¶Ô±È£¬´Ó¶øÊ¶±ð³ö°¢À­²®Êý×Ö // data Êý×ÖÊý¾Ý // num_templates ʶ±ðµÄÄ£°å£¬³¤¶ÈµÈÓÚdataµÄ³¤¶È // rows£¬cols Õû¸ödata ԭʼ¶þάÊý×éµÄ³¤¿í // num_width,num_heightÄ£°åÊý×ֵijߴç // line_number_count ÿһÐÐÔªËØµÄ×ܵÄÊý×Ö¸öÊý unsigned char** recognition_numbers(unsigned char* data, unsigned char* num_templates, const int rows, const int cols, const int num_width, const int num_height, const int line_number_count); //·Ö¸ôÿһÐÐÐèҪʶ±ðµÄÊý×Ö //½«Á¬ÐøµÄÊý×ÖͼƬ·Ö¸ô³Éµ¥¸öÊý×ÖµÄͼƬ£¬·½±ãʶ±ð void splitL2Num(unsigned char* img, int img_width, int img_height, int* pos, int pos_count, unsigned char* zero, int num_width, int num_height, int number_count, unsigned char* result); //·Ö¸ô°å¿éÊý×Ö,ͨÓà void splitPlateNum(cv::Mat img, IntDataInfo pos, UcharDataInfo result, UcharDataInfo types, unsigned char* zero, int num_width, int num_height, int ele_count_per_line, int length_per_num); void splitL2NumNew(cv::Mat img, IntDataInfo pos, UcharDataInfo result, UcharDataInfo types, unsigned char* zero, int num_width, int num_height, int ele_count_per_line, int length_per_num); void splitTradeQueueNum(cv::Mat img, IntDataInfo pos, UcharDataInfo result, UcharDataInfo types, unsigned char* zero, int num_width, int num_height, int ele_count_per_line, int length_per_num); //·Ö¸ô°å¿éÊý×Ö void splitPlateNum(unsigned char* img, int img_width, int img_height, int* pos, int pos_count, unsigned char* zero, int num_width, int num_height, int number_count, unsigned char* result); //·Ö¸ô½»Ò×¶ÓÁÐÊý×Ö void splitTradeQueueNum(cv::Mat img, IntDataInfo pos, unsigned char* zero, int num_width, int num_height, unsigned char* result, int length_per_num); //·Ö¸ôÐÐÊý¾Ý //ÿһÐеÄÊý¾Ý·Ö¸ô³É7¸öÇøÓò void splitL2RowData(cv::Mat img, int* rowIndexs, int lines, int* result); void splitRowData(cv::Mat img, int* rowIndexs, int lines,int ele_count_per_line, int* result); void splitPlateContentRowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines, int lineEleCount,int fromIndex,int toIndex, int* result); //ʶ±ð·ÇÊý×Ö void recognitionNotNum(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int colEleCount, int lines, int* result); void recognitionPlateMoneyUnit(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int colEleCount, int lines, int* result); };