卡证识别

最近更新时间:2024-07-23 18:12:12

我的收藏

简介

本文档提供关于卡证识别的相关 API 概览以及 SDK 示例代码。
API
操作描述
本接口支持中国大陆居民二代身份证正面(暂不支持背面)、驾驶证主页(暂不支持副页)所有字段的自动定位,暂不支持文本识别,用于对特定字段的抹除、屏蔽,以及进一步的文本识别

SDK API 参考

SDK 所有接口的具体参数与方法说明,请参考 SDK API

卡证识别

功能说明

本接口支持中国大陆居民二代身份证正面(暂不支持背面)、驾驶证主页(暂不支持副页)所有字段的自动定位,暂不支持文本识别,用于对特定字段的抹除、屏蔽,以及进一步的文本识别。
注意:
COS Android SDK 版本需要大于等于 v5.9.32。

示例代码

// 存储桶名称,格式为 BucketName-APPID
String bucket = "examplebucket-1250000000";
AILicenseRecRequest request = new AILicenseRecRequest(bucket, "folder/document.jpg");
request.detectUrl = "http://www.example.com/abc.jpg";// 设置您可以通过填写 detect-url 处理任意公网可访问的图片链接。不填写 detect-url 时,后台会默认处理 ObjectKey ,填写了 detect-url 时,后台会处理 detect-url 链接,无需再填写 ObjectKey detect-url 示例:http://www.example.com/abc.jpg
request.cardType = "IDCard";// 设置卡证识别类型,有效值为IDCard,DriverLicense。<br>IDCard表示身份证;DriverLicense表示驾驶证,默认:DriverLicense

cosXmlService.aiLicenseRecAsync(request, new CosXmlResultListener() {
@Override
public void onSuccess(CosXmlRequest request, CosXmlResult cosResult) {
// result 卡证识别的结果
// 详细字段请查看api文档或者SDK源码
AILicenseRecResult result = (AILicenseRecResult) cosResult;

}
@Override
public void onFail(CosXmlRequest request, CosXmlClientException clientException, CosXmlServiceException serviceException) {
if (clientException != null) {
clientException.printStackTrace();
} else {
serviceException.printStackTrace();
}
}
});

说明:
更多完整示例,请前往 GitHub 查看。