admin
2022-06-27 eda1a611bc4afcf1c36a6c728f432aec1f688e1b
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
#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();
    unsigned char** recognition_numbers(unsigned char* data, unsigned char* b_in, const int rows, const int cols, const int num_width, const int num_height, const int num_count);
 
    //·Ö¸ôÿһÐÐÐèҪʶ±ðµÄÊý×Ö
    void splitNum(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 createNumberTemplates(int lines, int num_width, int num_height, int num_count, uchar* numsOneLevelData, unsigned char* result);
 
    //·Ö¸ôÐÐÊý¾Ý
    void splitRowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines,
        int* result);
 
    void rgb2Gray(unsigned char* imgs, int imgWidth, int imgHeight,
        unsigned char* result);
    
 
};