1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
| #pragma once
| #include<stdio.h>
| #include<stdlib.h>
| #include<iostream>
| #include<CL/cl.h>
| #include "ImgUtil.h"
| 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;
|
| public:
| void init();
| void destory();
|
|
| //½«RGBͼƬתΪ»Ò¶ÈͼƬ
| void rgb2Gray(unsigned char* imgs, int imgWidth, int imgHeight,
| unsigned char* result);
|
| void rgba2Gray(unsigned char* imgs, int imgWidth, int imgHeight,
| unsigned char* result);
|
| //´´½¨Ê¶±ðµÄÊý×ÖÄ£°å
| void createNumberTemplates(int lines, int num_width, int num_height, int num_count, uchar* numsOneLevelData, unsigned char* result);
|
| //ʶ±ðÊý×Ö
| 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 num_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);
|
|
| //·Ö¸ôÐÐÊý¾Ý
| //ÿһÐеÄÊý¾Ý·Ö¸ô³É7¸öÇøÓò
| void splitL2RowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines,
| int* result);
|
| //ʶ±ð·ÇÊý×Ö
| void recognitionNotNum(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int colCount, int lines,
| int* result);
|
|
| };
|
|