admin
2023-03-07 8b06b1cbf112d55307ea8a6efe711db4e7506d89
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
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
//ͬ»¨Ë³¶ÌÏß¾«Áé
#include "OpenCLExcuter.h"
struct DXJLOCRContent {
    string time;
    //´úÂëÃû³Æ×ø±ê
    cv::Rect codeNamePos;
    //´úÂëλÖõÄMD5Öµ
    string codeNameMD5;
    //ʼþÃû³ÆÎ»ÖÃ
    cv::Rect eventNamePos;
    //ʼþ²ÎÊýλÖÃ
    cv::Rect eventParamsPos;
};
 
struct DXJLEvent {
    string time;
    string code;
    string eventName;
    string eventParams;
};
struct  DXJLResult
{
    list<DXJLOCRContent> contentList;
    cv::Mat grayImg;
};
 
typedef string (*CallbackFun_DXJL_OCR)(cv::Mat& grayImg);
 
 
class THSDXJLCapture
{
private:
    static OpenCLExcuter* openCLExcuter;
    //ÊÇ·ñÔÚ½»Ò×ʱ¼ä²Å½ØÍ¼
    static bool tradeTimeCapture;
    bool inited;
    //ÊÇ·ñÕýÔÚÖ´ÐÐ
    static bool running;
 
    static void* context;
 
    static CallbackFun_DXJL_OCR  ocr_fun;
 
    static void _run();
 
    static std::list<int*> splitRows(cv::Mat grayImg, int contentStartRow, std::list<int*> dataColIndexs);
 
    static std::list<int*> split(cv::Mat grayImg);
 
    static string md5Mat(cv::Mat grayImg);
 
    
    
public:
     void init(CallbackFun_DXJL_OCR matOcrFun);
 
     bool is_inited();
 
     void start();
 
     void stop();
 
     bool is_running();
 
 
     static DXJLResult capture();
 
     static DXJLResult capture(HWND hwnd);
 
     static DXJLResult capture(cv::Mat img,OpenCLExcuter * openCLExcuter);
 
     static std::list<DXJLOCRContent> captureGray(cv::Mat grayImg, OpenCLExcuter* openCLExcuter);
    
};