1 /*
2  * Copyright (C) 2021-2023 Alibaba Group Holding Limited
3  */
4 
5 #ifndef _OCR_H_
6 #define _OCR_H_
7 
8 #include "model/internal.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef union _RecogIdentityCardStruct {
15     struct {
16         char *address;
17         char *birthDate;
18         char *gender;
19         char *nationality;
20         char *iDNumber;
21         float cardX[4];
22         float cardY[4];
23         float faceX[4];
24         float faceY[4];
25         RectStruct location;
26     } face;
27     struct {
28         char *startDate;
29         char *issue;
30         char *endDate;
31     } back;
32 } RecogIdentityCardStruct;
33 
34 typedef struct _RecogBankCardStruct {
35     char *bankName;
36     char *cardNumber;
37     char *validDate;
38 } RecogBankCardStruct;
39 
40 typedef struct _RecogCharacterStruct {
41     char *text;
42     float probability;
43     int angle;
44     int left;
45     int top;
46     int height;
47     int width;
48 } RecogCharacterStruct;
49 
50 typedef struct _OcrResultStruct {
51     union {
52         RecogIdentityCardStruct identity;
53         RecogBankCardStruct bank;
54         RecogCharacterStruct character;
55     };
56 } OcrResultStruct;
57 
58 int recognizeIdentityCardFaceSide(char *url, AIModelCBFunc cb);
59 int recognizeIdentityCardBackSide(char *url, AIModelCBFunc cb);
60 int recognizeBankCard(char *url, AIModelCBFunc cb);
61 int recognizeCharacter(char *url, AIModelCBFunc cb);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 #endif
67