卡证识别

最近更新时间:2023-12-01 17:57:57

我的收藏

简介

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

卡证识别

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

方法原型

func (s *CIService) AILicenseRec(ctx context.Context, obj string, opt *AILicenseRecOptions) (*AILicenseRecResult, *Response, error)

请求示例

// 将 examplebucket-1250000000 和 COS_REGION 修改为真实的信息
bu, _ := url.Parse("https://examplebucket-1250000000.cos.COS_REGION.myqcloud.com")
b := &cos.BaseURL{BucketURL: bu}
c := cos.NewClient(b, &http.Client{
Transport: &cos.AuthorizationTransport{
SecretID: os.Getenv("SECRETID"),
SecretKey: os.Getenv("SECRETKEY"),
}
})
obj := "pic/carCard.jpeg"
opt := &cos.AILicenseRecOptions{
CardType: "DriverLicense",
}
res, _, err := c.CI.AILicenseRec(context.Background(), obj, opt)
log_status(err)
fmt.Printf("%+v\\n", res)

参数说明

type AILicenseRecOptions struct {
DetectUrl string `url:"detect-url,omitempty"`
CardType string `url:"CardType,omitempty"`
}

参数名称
参数描述
类型
是否必填
DetectUrl
您可以通过填写 detect-url 处理任意公网可访问的图片链接。不填写 detect-url 时,后台会默认处理 obj,填写了 detect-url 时,后台会处理 detect-url 链接,无需再填写 obj。
string
CardType
卡证识别类型,默认为 DriverLicense。有效值有:
IDCard:表示身份证。
DriverLicense:表示驾驶证。
string

结果说明

调用 AILicenseRec 函数,会解析 api 返回的 xml 内容到 AILicenseRecResult 结构,具体返回参数可查看 卡证识别 文档。