Browse Source

更新IPUOCRPlugin接口。以及更新IPUOcr库

huangyl3 5 years ago
parent
commit
036bf4e323

+ 9 - 0
IPUCommon/IPUOcr.framework/Headers/IPUOcrRequest.h

@ -28,6 +28,15 @@ NS_ASSUME_NONNULL_BEGIN
28 28
                     sdk_key:(NSString *)sdk_key
29 29
                     success:(IPUOcrRequestSuccessBlock)successBlock
30 30
                      failed:(IPUOcrRequestFailedBlock)failedBlock;
31
32
+ (void)ipuOcrGetFloCardInfoBD:(int)type
33
                       picInfo:(NSString *)picInfo
34
                      needMark:(BOOL)needMark
35
                         token:(NSString*)token
36
                      acc_type:(int)acc_type
37
                       success:(IPUOcrRequestSuccessBlock)successBlock
38
                        failed:(IPUOcrRequestFailedBlock)failedBlock;
39
31 40
@end
32 41
33 42
NS_ASSUME_NONNULL_END

+ 6 - 0
IPUCommon/IPUOcr.framework/Headers/IPUOcrRequestFoundation.h

@ -39,11 +39,17 @@ typedef void(^IPUOcrRequestFailedBlock)(NSString *error);
39 39
+ (NSString *)imageToBase64_JPG:(UIImage *)image;
40 40
41 41
+ (UIImage *)rectImage:(UIImage *)image rects:(NSArray *)rects color:(UIColor *)color;
42
// 带序号的
43
+ (UIImage *)rectImage2:(UIImage *)image rects:(NSArray *)rects color:(UIColor *)color;
42 44
43 45
+ (UIImage *)imageFromBase64EncodedString:(NSString *)base64String;
44 46
45 47
+ (id)jsonToObject:(NSString *)json;
46 48
49
+ (NSString *)toJSONString:(id)data;
50
51
+ (NSData *)toJSONData:(id)data;
52
47 53
@end
48 54
49 55
NS_ASSUME_NONNULL_END

BIN
IPUCommon/IPUOcr.framework/IPUOcr


BIN
display-center/display-center.xcworkspace/xcuserdata/huangyulin.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 0
display-center/display-center/IPUOCRPlugin.h

@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
18 18
// 水牌文字识别接口
19 19
- (void)getFloCardInfo:(NSArray *)params;
20 20
21
// 水牌文字识别,百度接口
22
- (void)getFloCardInfoBD:(NSArray *)params;
23
21 24
@end
22 25
23 26
NS_ASSUME_NONNULL_END

+ 38 - 0
display-center/display-center/IPUOCRPlugin.m

@ -78,4 +78,42 @@
78 78
    }
79 79
}
80 80
81
/*
82
 身份证识别,水牌识别,通用
83
 默认callBack():返回json数组
84
 params[0]-type:    图片格式,int类型,0:base64,1:图片地址
85
 params[1]-picInfo: 图片信息,string类型,如果type=0,则是图片的Base64位编码字符串,type=1,则是图片的存储路径字符串。
86
 params[2]-needMark: 是否返回包含位置信息的图片,BOOL类型,YES:返回图片base64字符串,NO:不返回
87
 params[3]-token:   百度接口的Token
88
 params[4]-acc_type:接口类型,int,0:高精度,1:一般精度
89
 err:错误信息返回。
90
 */
91
- (void)getFloCardInfoBD:(NSArray *)params {
92
    if (!params || params.count < 4) {
93
        [self error:@"参数不全,请核对参数!"];
94
        return ;
95
    }else {
96
        int type = [params[0] intValue];
97
        NSString *picInfo = params[1];
98
        BOOL needMark = [params[2] boolValue];
99
        NSString *token = params[3];
100
        int acc_type = 0;
101
        if (params.count == 5) {
102
            acc_type = [params[4] intValue];
103
        }
104
        [IPUOcrRequest ipuOcrGetFloCardInfoBD:type picInfo:picInfo needMark:needMark token:token acc_type:acc_type success:^(id  _Nonnull result) {
105
            NSDictionary *resultDic = result;
106
            NSMutableArray *callBackArray = [NSMutableArray arrayWithCapacity:0];
107
            [callBackArray addObject:resultDic[@"result"]];
108
            if (needMark) {
109
                [callBackArray addObject:resultDic[@"loc"]];
110
            }
111
            [self callback:[IPUJSONHelper toJSONString:[callBackArray mutableCopy]]];
112
        } failed:^(NSString * _Nonnull error) {
113
            [self error:error];
114
        }];
115
        
116
    }
117
}
118
81 119
@end