1 /*
2  * Copyright (C) 2021-2023 Alibaba Group Holding Limited
3  */
4 
5 #include <stdio.h>
6 #include <string.h>
7 #include "ucloud_ai_common.h"
8 
9 #define TAG "UCLOUD_AI_OCR"
10 
11 /*recognizing identity card has issue to be resolved*/
ucloud_ai_ocr_recognize_identity_card_face_side(char * path,ucloud_ai_cb_t cb)12 void ucloud_ai_ocr_recognize_identity_card_face_side(char *path, ucloud_ai_cb_t cb)
13 {
14     int ret;
15     int len;
16     char *p_upload_url;
17 
18     /*update capture.jpg to oss*/
19     p_upload_url = ucloud_ai_upload_file(path);
20     if (!p_upload_url)
21         return;
22 
23     recognizeIdentityCardFaceSide(p_upload_url, cb);
24     free(p_upload_url);
25 }
26 
ucloud_ai_ocr_recognize_identity_card_back_side(char * path,ucloud_ai_cb_t cb)27 void ucloud_ai_ocr_recognize_identity_card_back_side(char *path, ucloud_ai_cb_t cb)
28 {
29     int ret;
30     int len;
31     char *p_upload_url;
32 
33     /*update capture.jpg to oss*/
34     p_upload_url = ucloud_ai_upload_file(path);
35     if (!p_upload_url)
36         return;
37 
38     recognizeIdentityCardBackSide(p_upload_url, cb);
39     free(p_upload_url);
40 }
41 
ucloud_ai_ocr_recognize_bank_card(char * path,ucloud_ai_cb_t cb)42 void ucloud_ai_ocr_recognize_bank_card(char *path, ucloud_ai_cb_t cb)
43 {
44     int ret;
45     int len;
46     char *p_upload_url;
47 
48     /*update capture.jpg to oss*/
49     p_upload_url = ucloud_ai_upload_file(path);
50     if (!p_upload_url)
51         return;
52 
53     recognizeBankCard(p_upload_url, cb);
54     free(p_upload_url);
55 }
56 
ucloud_ai_ocr_recognize_character(char * path,ucloud_ai_cb_t cb)57 void ucloud_ai_ocr_recognize_character(char *path, ucloud_ai_cb_t cb)
58 {
59     int ret;
60     int len;
61     char *p_upload_url;
62 
63     /*update capture.jpg to oss*/
64     p_upload_url = ucloud_ai_upload_file(path);
65     if (!p_upload_url)
66         return;
67 
68     recognizeCharacter(p_upload_url, cb);
69     free(p_upload_url);
70 }
71