# 票据卡证识别 API 文档
# 接口说明
结构化识别身份证、结婚证、营业执照、驾驶证、户口本等常用20种卡片及证照,支持20种发票证件信息的准确性核验;还可使用OCR自定义平台,定制个性化识别模型。广泛适用于身份认证、金融开户、征信评估、商户入驻等业务场景。
部分开发语言demo如下,其他开发语言请参照文档进行开发,也欢迎热心的开发者到 讯飞开放平台社区 (opens new window) 分享你们的demo。
票据卡证识别 demo java语言 (opens new window)
票据卡证识别 demo python语言 (opens new window)集成票据卡证识别时,需按照以下要求:
内容 | 说明 |
---|---|
传输方式 | http[s] (为提高安全性,强烈推荐https) |
请求地址 | http(s): //cn-huadong-1.xf-yun.com/v1/inv 注:服务器IP不固定,为保证您的接口稳定,请勿通过指定IP的方式调用接口,使用域名方式调用 |
Content-Type | application/json;charset=UTF-8 |
接口鉴权 | 签名机制,详情请参照下方签名生成 |
字符编码 | UTF-8 |
响应格式 | 统一采用JSON格式 |
开发语言 | 任意,只要可以向讯飞云服务发起HTTP请求的均可 |
适用范围 | 任意操作系统,但因不支持跨域不适用于浏览器 |
图片格式 | jpg、jpeg、png、bmp、webp、tiff |
图片大小 | 最小尺寸:1B, 最大尺寸:10485760B |
# 鉴权说明
在调用业务接口时,请求方需要对请求进行签名,服务端通过签名来校验请求的合法性。
# 鉴权方法
通过在请求地址后面加上鉴权相关参数的方式,请注意影响鉴权结果的值有url、apiSecret、apiKey、date,如果调试鉴权,请务必按照示例中给的值进行调试,具体参数如下:
http示例url:
https://cn-huadong-1.xf-yun.com/v1/inv?host=cn-huadong-1.xf-yun.com&date=Fri%2C+24+Nov+2023+07%3A58%3A52+GMT&authorization=YXBpX2tleT0iYXBpc2VjcmV0WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFgiLCBhbGdvcml0aG09ImhtYWMtc2hhMjU2IiwgaGVhZGVycz0iaG9zdCBkYXRlIHJlcXVlc3QtbGluZSIsIHNpZ25hdHVyZT0iSk5aTHl4Z0p0clRUOW1UYm1pQ3VEclRoQ1ZhbDNhektJUXhId3Bza21Xaz0i
鉴权参数:
参数 | 类型 | 必须 | 说明 | 示例 |
---|---|---|---|---|
host | string | 是 | 请求主机 | cn-huadong-1.xf-yun.com |
date | string | 是 | 当前时间戳,RFC1123格式("EEE, dd MMM yyyy HH:mm:ss z") | Fri, 24 Nov 2023 07:58:52 GMT |
authorization | string | 是 | 使用base64编码的签名相关信息(签名基于hamc-sha256计算) | 参考下方详细生成规则 |
• date参数生成规则:
date必须是UTC+0或GMT时区,RFC1123格式(Fri, 24 Nov 2023 07:58:52 GMT)。
服务端会对date进行时钟偏移检查,最大允许300秒的偏差,超出偏差的请求都将被拒绝。
• authorization参数生成格式:
1)获取接口密钥APIKey 和 APISecret。
在讯飞开放平台控制台,创建一个应用后打开OCR中英文字识别页面可以获取,均为32位字符串。
2)参数authorization base64编码前(authorization_origin)的格式如下。
api_key="$api_key",algorithm="hmac-sha256",headers="host date request-line",signature="$signature"
其中 api_key 是在控制台获取的APIKey,algorithm 是加密算法(仅支持hmac-sha256),headers 是参与签名的参数(见下方注释)。
signature 是使用加密算法对参与签名的参数签名后并使用base64编码的字符串,详见下方。
注: headers是参与签名的参数,请注意是固定的参数名("host date request-line"),而非这些参数的值。
3)signature的原始字段(signature_origin)规则如下。
signature原始字段由 host,date,request-line三个参数按照格式拼接成,
拼接的格式为(\n为换行符,’:’后面有一个空格):
host: $host\ndate: $date\n$request-line
假设
请求url = "http(s)://cn-huadong-1.xf-yun.com/v1/inv"
date = "Fri, 24 Nov 2023 07:58:52 GMT"
那么 signature原始字段(signature_origin)则为:
host: cn-huadong-1.xf-yun.com
date: Fri, 24 Nov 2023 07:58:52 GMT
POST /v1/inv HTTP/1.1
4)使用hmac-sha256算法结合apiSecret对signature_origin签名,获得签名后的摘要signature_sha。
signature_sha=hmac-sha256(signature_origin,$apiSecret)
其中 apiSecret 是在控制台获取的APISecret
5)使用base64编码对signature_sha进行编码获得最终的signature。
signature=base64(signature_sha)
假设
APISecret = "apisecretXXXXXXXXXXXXXXXXXXXXXXX"
date = "Fri, 24 Nov 2023 07:58:52 GMT"
则signature为
signature="JNZLyxgJtrTT9mTbmiCuDrThCVal3azKIQxHwpskmWk="
6)根据以上信息拼接authorization base64编码前(authorization_origin)的字符串,示例如下。
api_key="apikeyXXXXXXXXXXXXXXXXXXXXXXXXXX", algorithm="hmac-sha256", headers="host date request-line", signature="JNZLyxgJtrTT9mTbmiCuDrThCVal3azKIQxHwpskmWk="
注: headers是参与签名的参数,请注意是固定的参数名("host date request-line"),而非这些参数的值。
7)最后再对authorization_origin进行base64编码获得最终的authorization参数。
authorization = base64(authorization_origin)
示例结果为:
authorization=YXBpX2tleT0iYXBpc2VjcmV0WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFgiLCBhbGdvcml0aG09ImhtYWMtc2hhMjU2IiwgaGVhZGVycz0iaG9zdCBkYXRlIHJlcXVlc3QtbGluZSIsIHNpZ25hdHVyZT0iSk5aTHl4Z0p0clRUOW1UYm1pQ3VEclRoQ1ZhbDNhektJUXhId3Bza21Xaz0i
# 鉴权结果
如果鉴权失败,则根据不同错误类型返回不同HTTP Code状态码,同时携带错误描述信息,详细错误说明如下:
HTTP Code | 说明 | 错误描述信息 | 解决方法 |
---|---|---|---|
401 | 缺少authorization参数 | {"message":"Unauthorized"} | 检查是否有authorization参数,详情见authorization参数详细生成规则 |
401 | 签名参数解析失败 | {“message”:”HMAC signature cannot be verified”} | 检查签名的各个参数是否有缺失是否正确,特别确认下复制的api_key是否正确 |
401 | 签名校验失败 | {“message”:”HMAC signature does not match”} | 签名验证失败,可能原因有很多。 1. 检查api_key,api_secret 是否正确。 2.检查计算签名的参数host,date,request-line是否按照协议要求拼接。 3. 检查signature签名的base64长度是否正常(正常44个字节)。 |
403 | 时钟偏移校验失败 | {“message”:”HMAC signature cannot be verified, a valid date or x-date header is required for HMAC Authentication”} | 检查服务器时间是否标准,相差5分钟以上会报此错误 |
时钟偏移校验失败示例:
HTTP/1.1 403 Forbidden
Date: Mon, 22 May 2023 05:44:14 GMT
Content-Length: 116
Content-Type: text/plain; charset=utf-8
{
"message": "HMAC signature does not match, a valid date or x-date header is required for HMAC Authentication"
}
# 请求参数
在调用业务接口时,都需要在 Http Request Body 中配置以下参数,请求数据均为json字符串。
请求参数示例:
{
"header": {
"app_id": "123456",
"status": 3
},
"parameter": {
"ocr": {
"type": "air_itinerary",
"level": 1,
"result": {
"encoding": "utf8",
"compress": "raw",
"format": "json"
}
}
},
"payload": {
"image": {
"encoding": "jpg",
"image": "MFApAT6cDaK······",
"status": 3
}
}
}
请求参数说明:
参数名 | 类型 | 必传 | 描述 |
---|---|---|---|
header | Object | 是 | 协议头部,用于描述平台特性的参数 |
header.app_id | string | 是 | 在平台申请的appid信息 |
header.uid | string | 否 | 请求用户服务返回的uid,用户及设备级别个性化功能依赖此参数 |
header.status | int | 是 | 请求状态,可选值为:3(一次传完) |
parameter | Object | 是 | AI 特性参数,用于控制 AI 引擎特性的开关。 |
parameter.ocr | Object | 是 | 服务别名 |
parameter.ocr.result | Object | 是 | 数据格式预期,用于描述返回结果的编码等相关约束,不同的数据类型,约束维度亦不相同,此 object 与响应结果存在对应关系。 |
parameter.ocr.result.encoding | string | 否 | 文本编码:utf8, gb2312 |
parameter.ocr.result.compress | string | 否 | 文本压缩格式 |
parameter.ocr.result.format | string | 否 | 文本格式 |
parameter.ocr.level | int | 否 | 1:输出文本行识别结果及位置,不输出图像信息, 3:仅输出文本行的top1结果,输出文本行及文本行位置,文本行base64到json中 |
parameter.ocr.type | string | 是 | type=id_card 身份证 type=print_invoice 机打发票 type=motor_vehicle 机动车销售发票 type=refund_voucher 退票凭证 type=didi_itinerary 网约车行程单 type=bus_license 营业执照 type=organization_code 组织机构代码证 type=household_register 户口本 type=drive_license 驾驶证 type=vehicle_card 行驶证 type=marriage_certificate 结婚证 type=vat_invoice 增值税发票 type=full_invoice 全电发票 type=roll_invoice 增值税发票(卷票) type=train_ticket 火车票 type=taxi_ticket 出租车发票 type=bus_passenger 客运汽车票 type=air_itinerary 航空行程单 type=quota_invoice 定额发票 type=road_toll 过路费发票 type=vehicle_qualification_certificate 车辆合格证 type=vehicle_registration_certificate 车辆登记证书 type=hygienic_license 卫生许可证 type=patent_certificate 专利证书 type=social_security_card 社保卡 type=chinese_passport 中国护照 type=temporary_id_card 临时身份证 type=divorce_certificate 离婚证 type=property_certificate 房屋所有权证 type=real_estate_certificate 不动产权证 type=institution_legal_person_certificate 事业单位法人证 type=non_tax_revenue_receipt 非税收入统一票据 type=mainland_travel_to_hongkong_macao_permit 往来港澳通行证 type=mainland_travel_to_taiwan_permit 往来台湾通行证 type=hongkong_macao_travel_to_mainland_permit 港澳居民来往内地通行证 type=taiwan_travel_to_mainland_permit 台湾居民来往大陆通行证 type=vehicle_compulsory_insurance 机动车交强险保单 type=vehicle_commercial_insurance 机动车商业险保单 type=mobile_payment_voucher 手机支付凭证 type=tax_payment_certificate 税收完税证明 type=shopping_receipt 购物小票 type=tax_registration_certificate 税务登记证 type=construction_qualification_certificate 建筑企业资质证书 type=quality_management_certificate 质量管理体系证书 type=medical_invoice 医疗发票 type=bank_receipt 银行回单 type=bank_acceptance_bill 银行承兑汇票 type=hongkong_id_card 香港身份证 type=macao_id_card 澳门身份证 type=taiwan_id_card 台湾身份证 type=birth_medical_certificate 出生医学证明 type=business_card 名片 type=ship_ticket 船票 type=used_vehicle_invoice 二手车销售发票 type=hongkong_macao_taiwan_residence_permit 港澳台居民居住证 type=foreigner_residence_permit 外国人永久居留证 type=teacher_certificate 教师资格证 type=disability_certificate 残疾人证 type=physician_practice_certificate 医师执业证 type=constructor_certificate 建造师证 type=lawyer_certificate 律师证 type=tourist_guide_certificate 导游证 type=transfer_cheque 转账支票 type=bank_card 银行卡 |
payload | Object | 是 | 数据段,携带请求的数据 |
payload.image | Object | 是 | 输入数据 |
payload.image.encoding | string | 否 | 图像编码,jpg、 jpeg、 png、bmp、webp、tiff |
payload.image.iamge | string | 是 | 图像数据,base64后最小尺寸:0B, 最大尺寸:10485760B |
payload.image.status | int | 否 | 数据状态,取值范围为:3(一次传完) |
# 返回结果
返回参数示例:
{
"header": {
"code": "0",
"message": "success",
"sid": "ase000704fa@dx16ade44e4d87a1c802",
"status": 3
},
"payload": {
"result": {
"encoding": "utf8",
"compress": "raw",
"format": "json",
"text": "AGAjvgDA8D······",
"status": 3
}
}
}
text字段Base64解码后示例:
{
"engine_version" : "3.0.3004",
"error_code" : 0,
"error_msg" : "success",
"object_count" : 1,
"object_list" :
[
{
"description" : "航空行程单",
"error_code" : 0,
"error_msg" : "Success",
"height" : 1048,
"idx" : 0,
"qrcode_count" : 0,
"qrcode_list" : [],
"region_count" : 16,
"region_list" :
[
{
"id" : "0",
"order" : 0,
"position" :
{
"bl_point" :
{
"x" : 237,
"y" : 537
},
"br_point" :
{
"x" : 1403,
"y" : 537
},
"tl_point" :
{
"x" : 237,
"y" : 416
},
"tr_point" :
{
"x" : 1403,
"y" : 416
}
},
"text_block_count" : 9,
"text_block_list" :
[
{
"class" : "air-from-city",
"id" : "0",
"key" : "air-from-city",
"position" :
{
"bl_point" :
{
"x" : 242,
"y" : 464
},
"br_point" :
{
"x" : 307,
"y" : 464
},
"tl_point" :
{
"x" : 242,
"y" : 416
},
"tr_point" :
{
"x" : 307,
"y" : 416
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 6,
"det_score" : 0.99709796905517578,
"position" :
{
"bl_point" :
{
"x" : 242,
"y" : 464
},
"br_point" :
{
"x" : 307,
"y" : 464
},
"tl_point" :
{
"x" : 242,
"y" : 416
},
"tr_point" :
{
"x" : 307,
"y" : 416
}
},
"score" : 0.99831342697143555,
"text" : "湛江"
}
],
"value" : "湛江"
},
{
"class" : "air-to-city",
"id" : "1",
"key" : "air-to-city",
"position" :
{
"bl_point" :
{
"x" : 245,
"y" : 526
},
"br_point" :
{
"x" : 362,
"y" : 526
},
"tl_point" :
{
"x" : 245,
"y" : 473
},
"tr_point" :
{
"x" : 362,
"y" : 473
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 12,
"det_score" : 0.99608021974563599,
"position" :
{
"bl_point" :
{
"x" : 245,
"y" : 526
},
"br_point" :
{
"x" : 362,
"y" : 526
},
"tl_point" :
{
"x" : 245,
"y" : 473
},
"tr_point" :
{
"x" : 362,
"y" : 473
}
},
"score" : 0.99829518795013428,
"text" : "上海虹桥"
}
],
"value" : "上海虹桥"
},
{
"class" : "air-flight",
"id" : "2",
"key" : "air-flight",
"position" :
{
"bl_point" :
{
"x" : 550,
"y" : 466
},
"br_point" :
{
"x" : 650,
"y" : 466
},
"tl_point" :
{
"x" : 550,
"y" : 440
},
"tr_point" :
{
"x" : 650,
"y" : 440
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 6,
"det_score" : 0.99514162540435791,
"position" :
{
"bl_point" :
{
"x" : 550,
"y" : 466
},
"br_point" :
{
"x" : 650,
"y" : 466
},
"tl_point" :
{
"x" : 550,
"y" : 440
},
"tr_point" :
{
"x" : 650,
"y" : 440
}
},
"score" : 0.99732989072799683,
"text" : "FM9404"
}
],
"value" : "FM9404"
},
{
"class" : "air-date",
"id" : "3",
"key" : "air-date",
"position" :
{
"bl_point" :
{
"x" : 707,
"y" : 471
},
"br_point" :
{
"x" : 870,
"y" : 471
},
"tl_point" :
{
"x" : 707,
"y" : 440
},
"tr_point" :
{
"x" : 870,
"y" : 440
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 10,
"det_score" : 0.99402099847793579,
"position" :
{
"bl_point" :
{
"x" : 707,
"y" : 471
},
"br_point" :
{
"x" : 870,
"y" : 471
},
"tl_point" :
{
"x" : 707,
"y" : 440
},
"tr_point" :
{
"x" : 870,
"y" : 440
}
},
"score" : 0.99976277351379395,
"text" : "2020-08-27"
}
],
"value" : "2020-08-27"
},
{
"class" : "air-time",
"id" : "4",
"key" : "air-time",
"position" :
{
"bl_point" :
{
"x" : 881,
"y" : 471
},
"br_point" :
{
"x" : 964,
"y" : 471
},
"tl_point" :
{
"x" : 881,
"y" : 441
},
"tr_point" :
{
"x" : 964,
"y" : 441
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 5,
"det_score" : 0.99418479204177856,
"position" :
{
"bl_point" :
{
"x" : 881,
"y" : 471
},
"br_point" :
{
"x" : 964,
"y" : 471
},
"tl_point" :
{
"x" : 881,
"y" : 441
},
"tr_point" :
{
"x" : 964,
"y" : 441
}
},
"score" : 0.99704039096832275,
"text" : "11:30"
}
],
"value" : "11:30"
},
{
"class" : "air-fare-basis",
"id" : "5",
"key" : "air-fare-basis",
"position" :
{
"bl_point" :
{
"x" : 975,
"y" : 466
},
"br_point" :
{
"x" : 997,
"y" : 466
},
"tl_point" :
{
"x" : 975,
"y" : 440
},
"tr_point" :
{
"x" : 997,
"y" : 440
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 90.0,
"char_count" : 1,
"det_score" : 0.93712145090103149,
"position" :
{
"bl_point" :
{
"x" : 975,
"y" : 466
},
"br_point" :
{
"x" : 997,
"y" : 466
},
"tl_point" :
{
"x" : 975,
"y" : 440
},
"tr_point" :
{
"x" : 997,
"y" : 440
}
},
"score" : 0.99790793657302856,
"text" : "T"
}
],
"value" : "T"
},
{
"class" : "air-allow",
"id" : "6",
"key" : "air-allow",
"position" :
{
"bl_point" :
{
"x" : 1330,
"y" : 470
},
"br_point" :
{
"x" : 1385,
"y" : 470
},
"tl_point" :
{
"x" : 1330,
"y" : 439
},
"tr_point" :
{
"x" : 1385,
"y" : 439
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 3,
"det_score" : 0.9901459813117981,
"position" :
{
"bl_point" :
{
"x" : 1330,
"y" : 470
},
"br_point" :
{
"x" : 1385,
"y" : 470
},
"tl_point" :
{
"x" : 1330,
"y" : 439
},
"tr_point" :
{
"x" : 1385,
"y" : 439
}
},
"score" : 0.99901694059371948,
"text" : "20K"
}
],
"value" : "20K"
},
{
"class" : "air-carrier",
"id" : "7",
"key" : "air-carrier",
"position" :
{
"bl_point" :
{
"x" : 497,
"y" : 467
},
"br_point" :
{
"x" : 549,
"y" : 467
},
"tl_point" :
{
"x" : 497,
"y" : 419
},
"tr_point" :
{
"x" : 549,
"y" : 419
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 6,
"det_score" : 0.99045580625534058,
"position" :
{
"bl_point" :
{
"x" : 497,
"y" : 467
},
"br_point" :
{
"x" : 549,
"y" : 467
},
"tl_point" :
{
"x" : 497,
"y" : 419
},
"tr_point" :
{
"x" : 549,
"y" : 419
}
},
"score" : 0.99578756093978882,
"text" : "上航"
}
],
"value" : "上航"
},
{
"class" : "air-seat-class",
"id" : "8",
"key" : "air-seat-class",
"position" :
{
"bl_point" :
{
"x" : 676,
"y" : 467
},
"br_point" :
{
"x" : 697,
"y" : 467
},
"tl_point" :
{
"x" : 676,
"y" : 440
},
"tr_point" :
{
"x" : 697,
"y" : 440
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 90.0,
"char_count" : 1,
"det_score" : 0.94012981653213501,
"position" :
{
"bl_point" :
{
"x" : 676,
"y" : 467
},
"br_point" :
{
"x" : 697,
"y" : 467
},
"tl_point" :
{
"x" : 676,
"y" : 440
},
"tr_point" :
{
"x" : 697,
"y" : 440
}
},
"score" : 0.9972909688949585,
"text" : "T"
}
],
"value" : "T"
}
],
"type" : "air-items"
},
{
"id" : "1",
"order" : 1,
"position" :
{
"bl_point" :
{
"x" : 627,
"y" : 262
},
"br_point" :
{
"x" : 958,
"y" : 262
},
"tl_point" :
{
"x" : 627,
"y" : 226
},
"tr_point" :
{
"x" : 958,
"y" : 226
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-invoice-type",
"id" : "0",
"key" : "air-invoice-type",
"position" :
{
"bl_point" :
{
"x" : 627,
"y" : 262
},
"br_point" :
{
"x" : 958,
"y" : 262
},
"tl_point" :
{
"x" : 627,
"y" : 226
},
"tr_point" :
{
"x" : 958,
"y" : 226
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 33,
"det_score" : 0.99821943044662476,
"position" :
{
"bl_point" :
{
"x" : 627,
"y" : 262
},
"br_point" :
{
"x" : 958,
"y" : 262
},
"tl_point" :
{
"x" : 627,
"y" : 226
},
"tr_point" :
{
"x" : 958,
"y" : 226
}
},
"score" : 0.99951404333114624,
"text" : "航空运输电子客票行程单"
}
],
"value" : "航空运输电子客票行程单"
}
],
"type" : "air-invoice-type"
},
{
"id" : "2",
"order" : 2,
"position" :
{
"bl_point" :
{
"x" : 240,
"y" : 370
},
"br_point" :
{
"x" : 304,
"y" : 370
},
"tl_point" :
{
"x" : 240,
"y" : 322
},
"tr_point" :
{
"x" : 304,
"y" : 322
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-name",
"id" : "0",
"key" : "air-name",
"position" :
{
"bl_point" :
{
"x" : 240,
"y" : 370
},
"br_point" :
{
"x" : 304,
"y" : 370
},
"tl_point" :
{
"x" : 240,
"y" : 322
},
"tr_point" :
{
"x" : 304,
"y" : 322
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 6,
"det_score" : 0.99598997831344604,
"position" :
{
"bl_point" :
{
"x" : 240,
"y" : 370
},
"br_point" :
{
"x" : 304,
"y" : 370
},
"tl_point" :
{
"x" : 240,
"y" : 322
},
"tr_point" :
{
"x" : 304,
"y" : 322
}
},
"score" : 0.99903076887130737,
"text" : "刘广"
}
],
"value" : "刘广"
}
],
"type" : "air-name"
},
{
"id" : "3",
"order" : 3,
"position" :
{
"bl_point" :
{
"x" : 517,
"y" : 374
},
"br_point" :
{
"x" : 814,
"y" : 374
},
"tl_point" :
{
"x" : 517,
"y" : 344
},
"tr_point" :
{
"x" : 814,
"y" : 344
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-id",
"id" : "0",
"key" : "air-id",
"position" :
{
"bl_point" :
{
"x" : 517,
"y" : 374
},
"br_point" :
{
"x" : 814,
"y" : 374
},
"tl_point" :
{
"x" : 517,
"y" : 344
},
"tr_point" :
{
"x" : 814,
"y" : 344
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 18,
"det_score" : 0.9946712851524353,
"position" :
{
"bl_point" :
{
"x" : 517,
"y" : 374
},
"br_point" :
{
"x" : 814,
"y" : 374
},
"tl_point" :
{
"x" : 517,
"y" : 344
},
"tr_point" :
{
"x" : 814,
"y" : 344
}
},
"score" : 0.9989858865737915,
"text" : "120823198906212032"
}
],
"value" : "120823198906212032"
}
],
"type" : "air-id"
},
{
"id" : "4",
"order" : 4,
"position" :
{
"bl_point" :
{
"x" : 1158,
"y" : 299
},
"br_point" :
{
"x" : 1411,
"y" : 299
},
"tl_point" :
{
"x" : 1158,
"y" : 265
},
"tr_point" :
{
"x" : 1411,
"y" : 265
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-print-number",
"id" : "0",
"key" : "air-print-number",
"position" :
{
"bl_point" :
{
"x" : 1158,
"y" : 299
},
"br_point" :
{
"x" : 1411,
"y" : 299
},
"tl_point" :
{
"x" : 1158,
"y" : 265
},
"tr_point" :
{
"x" : 1411,
"y" : 265
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 12,
"det_score" : 0.99651956558227539,
"position" :
{
"bl_point" :
{
"x" : 1158,
"y" : 299
},
"br_point" :
{
"x" : 1411,
"y" : 299
},
"tl_point" :
{
"x" : 1158,
"y" : 265
},
"tr_point" :
{
"x" : 1411,
"y" : 265
}
},
"score" : 0.9971194863319397,
"text" : "5252976434 1"
}
],
"value" : "5252976434 1"
}
],
"type" : "air-print-number"
},
{
"id" : "5",
"order" : 5,
"position" :
{
"bl_point" :
{
"x" : 438,
"y" : 685
},
"br_point" :
{
"x" : 617,
"y" : 685
},
"tl_point" :
{
"x" : 438,
"y" : 658
},
"tr_point" :
{
"x" : 617,
"y" : 658
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-fare",
"id" : "0",
"key" : "air-fare",
"position" :
{
"bl_point" :
{
"x" : 438,
"y" : 685
},
"br_point" :
{
"x" : 617,
"y" : 685
},
"tl_point" :
{
"x" : 438,
"y" : 658
},
"tr_point" :
{
"x" : 617,
"y" : 658
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 10,
"det_score" : 0.99568057060241699,
"position" :
{
"bl_point" :
{
"x" : 438,
"y" : 685
},
"br_point" :
{
"x" : 617,
"y" : 685
},
"tl_point" :
{
"x" : 438,
"y" : 658
},
"tr_point" :
{
"x" : 617,
"y" : 658
}
},
"score" : 0.99928277730941772,
"text" : "CNY 615.00"
}
],
"value" : "CNY 615.00"
}
],
"type" : "air-fare"
},
{
"id" : "6",
"order" : 6,
"position" :
{
"bl_point" :
{
"x" : 617,
"y" : 686
},
"br_point" :
{
"x" : 795,
"y" : 686
},
"tl_point" :
{
"x" : 617,
"y" : 659
},
"tr_point" :
{
"x" : 795,
"y" : 659
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-fund",
"id" : "0",
"key" : "air-fund",
"position" :
{
"bl_point" :
{
"x" : 617,
"y" : 686
},
"br_point" :
{
"x" : 795,
"y" : 686
},
"tl_point" :
{
"x" : 617,
"y" : 659
},
"tr_point" :
{
"x" : 795,
"y" : 659
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 8,
"det_score" : 0.99241745471954346,
"position" :
{
"bl_point" :
{
"x" : 617,
"y" : 686
},
"br_point" :
{
"x" : 795,
"y" : 686
},
"tl_point" :
{
"x" : 617,
"y" : 659
},
"tr_point" :
{
"x" : 795,
"y" : 659
}
},
"score" : 0.99719148874282837,
"text" : "CN 50.00"
}
],
"value" : "CN 50.00"
}
],
"type" : "air-fund"
},
{
"id" : "7",
"order" : 7,
"position" :
{
"bl_point" :
{
"x" : 1140,
"y" : 689
},
"br_point" :
{
"x" : 1392,
"y" : 689
},
"tl_point" :
{
"x" : 1140,
"y" : 662
},
"tr_point" :
{
"x" : 1392,
"y" : 662
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-total",
"id" : "0",
"key" : "air-total",
"position" :
{
"bl_point" :
{
"x" : 1140,
"y" : 689
},
"br_point" :
{
"x" : 1392,
"y" : 689
},
"tl_point" :
{
"x" : 1140,
"y" : 662
},
"tr_point" :
{
"x" : 1392,
"y" : 662
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 10,
"det_score" : 0.9875253438949585,
"position" :
{
"bl_point" :
{
"x" : 1140,
"y" : 689
},
"br_point" :
{
"x" : 1392,
"y" : 689
},
"tl_point" :
{
"x" : 1140,
"y" : 662
},
"tr_point" :
{
"x" : 1392,
"y" : 662
}
},
"score" : 0.99960571527481079,
"text" : "CNY 665.00"
}
],
"value" : "CNY 665.00"
}
],
"type" : "air-total"
},
{
"id" : "8",
"order" : 8,
"position" :
{
"bl_point" :
{
"x" : 311,
"y" : 742
},
"br_point" :
{
"x" : 523,
"y" : 742
},
"tl_point" :
{
"x" : 311,
"y" : 714
},
"tr_point" :
{
"x" : 523,
"y" : 714
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-e-number",
"id" : "0",
"key" : "air-e-number",
"position" :
{
"bl_point" :
{
"x" : 311,
"y" : 742
},
"br_point" :
{
"x" : 523,
"y" : 742
},
"tl_point" :
{
"x" : 311,
"y" : 714
},
"tr_point" :
{
"x" : 523,
"y" : 714
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 13,
"det_score" : 0.99655401706695557,
"position" :
{
"bl_point" :
{
"x" : 311,
"y" : 742
},
"br_point" :
{
"x" : 523,
"y" : 742
},
"tl_point" :
{
"x" : 311,
"y" : 714
},
"tr_point" :
{
"x" : 523,
"y" : 714
}
},
"score" : 0.99963384866714478,
"text" : "7812325141434"
}
],
"value" : "7812325141434"
}
],
"type" : "air-e-number"
},
{
"id" : "9",
"order" : 9,
"position" :
{
"bl_point" :
{
"x" : 624,
"y" : 815
},
"br_point" :
{
"x" : 1035,
"y" : 815
},
"tl_point" :
{
"x" : 624,
"y" : 761
},
"tr_point" :
{
"x" : 1035,
"y" : 761
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-issued",
"id" : "0",
"key" : "air-issued",
"position" :
{
"bl_point" :
{
"x" : 624,
"y" : 815
},
"br_point" :
{
"x" : 1035,
"y" : 815
},
"tl_point" :
{
"x" : 624,
"y" : 761
},
"tr_point" :
{
"x" : 1035,
"y" : 761
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 41,
"det_score" : 0.99117076396942139,
"position" :
{
"bl_point" :
{
"x" : 624,
"y" : 815
},
"br_point" :
{
"x" : 1035,
"y" : 815
},
"tl_point" :
{
"x" : 624,
"y" : 761
},
"tr_point" :
{
"x" : 1035,
"y" : 761
}
},
"score" : 0.99865919351577759,
"text" : "阿斯兰航空服务(上海)有限公司"
}
],
"value" : "阿斯兰航空服务(上海)有限公司"
}
],
"type" : "air-issued"
},
{
"id" : "10",
"order" : 10,
"position" :
{
"bl_point" :
{
"x" : 1229,
"y" : 816
},
"br_point" :
{
"x" : 1400,
"y" : 816
},
"tl_point" :
{
"x" : 1229,
"y" : 788
},
"tr_point" :
{
"x" : 1400,
"y" : 788
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-issued-date",
"id" : "0",
"key" : "air-issued-date",
"position" :
{
"bl_point" :
{
"x" : 1229,
"y" : 816
},
"br_point" :
{
"x" : 1400,
"y" : 816
},
"tl_point" :
{
"x" : 1229,
"y" : 788
},
"tr_point" :
{
"x" : 1400,
"y" : 788
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 10,
"det_score" : 0.99469500780105591,
"position" :
{
"bl_point" :
{
"x" : 1229,
"y" : 816
},
"br_point" :
{
"x" : 1400,
"y" : 816
},
"tl_point" :
{
"x" : 1229,
"y" : 788
},
"tr_point" :
{
"x" : 1400,
"y" : 788
}
},
"score" : 0.99968534708023071,
"text" : "2020-08-28"
}
],
"value" : "2020-08-28"
}
],
"type" : "air-issued-date"
},
{
"id" : "11",
"order" : 11,
"position" :
{
"bl_point" :
{
"x" : 1332,
"y" : 747
},
"br_point" :
{
"x" : 1391,
"y" : 747
},
"tl_point" :
{
"x" : 1332,
"y" : 720
},
"tr_point" :
{
"x" : 1391,
"y" : 720
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-insurance",
"id" : "0",
"key" : "air-insurance",
"position" :
{
"bl_point" :
{
"x" : 1332,
"y" : 747
},
"br_point" :
{
"x" : 1391,
"y" : 747
},
"tl_point" :
{
"x" : 1332,
"y" : 720
},
"tr_point" :
{
"x" : 1391,
"y" : 720
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 3,
"det_score" : 0.98500943183898926,
"position" :
{
"bl_point" :
{
"x" : 1332,
"y" : 747
},
"br_point" :
{
"x" : 1391,
"y" : 747
},
"tl_point" :
{
"x" : 1332,
"y" : 720
},
"tr_point" :
{
"x" : 1391,
"y" : 720
}
},
"score" : 0.99959379434585571,
"text" : "XXX"
}
],
"value" : "XXX"
}
],
"type" : "air-insurance"
},
{
"id" : "12",
"order" : 12,
"position" :
{
"bl_point" :
{
"x" : 298,
"y" : 806
},
"br_point" :
{
"x" : 458,
"y" : 806
},
"tl_point" :
{
"x" : 298,
"y" : 754
},
"tr_point" :
{
"x" : 458,
"y" : 754
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-agent-code",
"id" : "0",
"key" : "air-agent-code",
"position" :
{
"bl_point" :
{
"x" : 298,
"y" : 806
},
"br_point" :
{
"x" : 458,
"y" : 806
},
"tl_point" :
{
"x" : 298,
"y" : 754
},
"tr_point" :
{
"x" : 458,
"y" : 754
}
},
"tag" : "",
"text_sent_count" : 2,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 6,
"det_score" : 0.99477934837341309,
"position" :
{
"bl_point" :
{
"x" : 298,
"y" : 777
},
"br_point" :
{
"x" : 398,
"y" : 777
},
"tl_point" :
{
"x" : 298,
"y" : 753
},
"tr_point" :
{
"x" : 398,
"y" : 753
}
},
"score" : 0.99917256832122803,
"text" : "SHA777"
},
{
"angle" : 0.0,
"char_count" : 8,
"det_score" : 0.99391162395477295,
"position" :
{
"bl_point" :
{
"x" : 327,
"y" : 807
},
"br_point" :
{
"x" : 459,
"y" : 807
},
"tl_point" :
{
"x" : 327,
"y" : 784
},
"tr_point" :
{
"x" : 459,
"y" : 784
}
},
"score" : 0.99796849489212036,
"text" : "08677247"
}
],
"value" : "SHA777\n08677247"
}
],
"type" : "air-agent-code"
},
{
"id" : "13",
"order" : 13,
"position" :
{
"bl_point" :
{
"x" : 233,
"y" : 404
},
"br_point" :
{
"x" : 340,
"y" : 404
},
"tl_point" :
{
"x" : 233,
"y" : 379
},
"tr_point" :
{
"x" : 340,
"y" : 379
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-record",
"id" : "0",
"key" : "air-record",
"position" :
{
"bl_point" :
{
"x" : 233,
"y" : 404
},
"br_point" :
{
"x" : 340,
"y" : 404
},
"tl_point" :
{
"x" : 233,
"y" : 379
},
"tr_point" :
{
"x" : 340,
"y" : 379
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 6,
"det_score" : 0.99295336008071899,
"position" :
{
"bl_point" :
{
"x" : 233,
"y" : 404
},
"br_point" :
{
"x" : 340,
"y" : 404
},
"tl_point" :
{
"x" : 233,
"y" : 379
},
"tr_point" :
{
"x" : 340,
"y" : 379
}
},
"score" : 0.99859273433685303,
"text" : "MHHK8B"
}
],
"value" : "MHHK8B"
}
],
"type" : "air-record"
},
{
"id" : "14",
"order" : 14,
"position" :
{
"bl_point" :
{
"x" : 628,
"y" : 743
},
"br_point" :
{
"x" : 698,
"y" : 743
},
"tl_point" :
{
"x" : 628,
"y" : 717
},
"tr_point" :
{
"x" : 698,
"y" : 717
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-check-code",
"id" : "0",
"key" : "air-check-code",
"position" :
{
"bl_point" :
{
"x" : 628,
"y" : 743
},
"br_point" :
{
"x" : 698,
"y" : 743
},
"tl_point" :
{
"x" : 628,
"y" : 717
},
"tr_point" :
{
"x" : 698,
"y" : 717
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 4,
"det_score" : 0.99478203058242798,
"position" :
{
"bl_point" :
{
"x" : 628,
"y" : 743
},
"br_point" :
{
"x" : 698,
"y" : 743
},
"tl_point" :
{
"x" : 628,
"y" : 717
},
"tr_point" :
{
"x" : 698,
"y" : 717
}
},
"score" : 0.99878549575805664,
"text" : "6434"
}
],
"value" : "6434"
}
],
"type" : "air-check-code"
},
{
"id" : "15",
"order" : 15,
"position" :
{
"bl_point" :
{
"x" : 889,
"y" : 374
},
"br_point" :
{
"x" : 1166,
"y" : 374
},
"tl_point" :
{
"x" : 889,
"y" : 325
},
"tr_point" :
{
"x" : 1166,
"y" : 325
}
},
"text_block_count" : 1,
"text_block_list" :
[
{
"class" : "air-endorsements",
"id" : "0",
"key" : "air-endorsements",
"position" :
{
"bl_point" :
{
"x" : 889,
"y" : 374
},
"br_point" :
{
"x" : 1166,
"y" : 374
},
"tl_point" :
{
"x" : 889,
"y" : 325
},
"tr_point" :
{
"x" : 1166,
"y" : 325
}
},
"tag" : "",
"text_sent_count" : 1,
"text_sent_list" :
[
{
"angle" : 0.0,
"char_count" : 27,
"det_score" : 0.99518615007400513,
"position" :
{
"bl_point" :
{
"x" : 889,
"y" : 374
},
"br_point" :
{
"x" : 1166,
"y" : 374
},
"tl_point" :
{
"x" : 889,
"y" : 325
},
"tr_point" :
{
"x" : 1166,
"y" : 325
}
},
"score" : 0.98693078756332397,
"text" : "Q/不得签转/退改收费"
}
],
"value" : "Q/不得签转/退改收费"
}
],
"type" : "air-endorsements"
}
],
"table_count" : 0,
"table_list" : [],
"type" : "air_itinerary",
"width" : 1608
}
],
"version" : "2.0"
}
返回参数说明:
参数名 | 类型 | 描述 |
---|---|---|
header | object | 用于描述平台特性的参数 |
header.code | int | 0表示会话调用成功(并不一定表示服务调用成功,服务是否调用成功以text字段为准) |
header.message | string | 描述信息 |
header.sid | string | 本次会话唯一标识id |
payload | object | 数据段,用于携带响应的数据 |
payload.result | object | 响应数据块 |
payload.result.compress | string | 文本压缩格式 |
payload.result.encoding | string | 文本编码格式 |
payload.result.format | string | 文本格式 |
payload.result.text | string | 返回的文本数据,需要对其进行base64解码,详细参数说明见下方 |
payload.resultstatus | string | 状态码 |
payload.result.text字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
engine_version | string | 引擎版本号 |
error_code | float | 返回码,0: 成功 |
error_msg | string | 描述返回码信息,Success: 成功 |
object_count | float | 目标数量,1: 目标数量 |
object_list | array | 目标版面分析结果,详细参数解析见下方 |
version | float | json协议的版本号 |
payload.result.text.object_list字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
description | string | 描述当前模板信息,身份证: 身份证模板 |
error_code | float | 当前图片识别错误码,0: 成功 |
error_msg | string | 当前图片识别错误码信息,Success: 成功 |
height | float | 目标图像的高度 |
idx | float | 输出图片索引 |
qrcode_count | float | 二维码数量 |
qrcode_list | array | 二维码区域 |
region_count | float | 通用区域数量 |
region_list | array | 通用区域 |
table_count | float | 表格区域数量 |
table_list | array | 表格区域 |
type | string | 目标类型,id_card: 身份证 |
width | float | 目标图像的宽带 |
payload.result.text.object_list.region_list字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
id | string | id(与模板json内对应区域id相同) |
order | float | 同层级内的阅读顺序 |
position | object | 区域位置 |
text_block_count | float | 文本块数量(对于非文本块区域应填0) |
text_block_list | array | 文本块结果(对于非文本块区域该数组为空) |
type | string | 区域类型为地址 |
payload.result.text.object_list.region_list.position字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
bl_point | object | 左下角坐标 |
bl_point.x | float | X坐标 |
bl_point.y | loat | y坐标 |
br_point | object | 右下角坐标 |
br_point.x | float | X坐标 |
br_point.y | float | y坐标 |
tl_point | object | 左上角坐标 |
tl_point.x | float | X坐标 |
tl_point.y | float | y坐标 |
tr_point | object | 右上角坐标 |
tr_point.x | float | X坐标 |
tr_point.y | float | y坐标 |
payload.result.text.object_list.region_list.text_block_list字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
class | string | 所属要素类型为地址 |
id | string | id识别码 |
key | string | 要素key值为地址 |
ocr_flag | float | 保留字段 |
order | float | 同层级内的阅读顺序 |
position | object | 区域位置 |
tag | string | 标签 |
text_sent_count | float | 文本行数量 |
text_sent_list | array | 识别的文本行(text_block内可能包含多行文本) |
value | string | 识别结果 |
payload.result.text.object_list.region_list.text_block_list.position字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
bl_point | object | 左下角坐标 |
bl_point.x | float | X坐标 |
bl_point.y | float | y坐标 |
br_point | object | 右下角坐标 |
br_point.x | float | X坐标 |
br_point.y | float | y坐标 |
tl_point | object | 左上角坐标 |
tl_point.x | float | X坐标 |
tl_point.y | float | y坐标 |
tr_point | object | 右上角坐标 |
tr_poin.x | float | X坐标 |
tr_poin.y | float | y坐标 |
payload.result.text.object_list.region_list.text_block_list.text_sent_list字段base64解码后信息如下:
参数名 | 类型 | 描述 |
---|---|---|
angle | float | 文本行角度 |
char_count | float | 文本行字符数 |
det_score | float | 该行区域检测置信度 |
position | object | 文本行区域位置 |
bl_point | object | 左下角坐标 |
bl_point.x | float | X坐标 |
bl_point.y | float | y坐标 |
br_point | object | 右下角坐标 |
br_point.x | float | X坐标 |
br_point.y | float | y坐标 |
tl_point | object | 左上角坐标 |
tl_point.x | float | X坐标 |
tl_point.y | float | 坐标 |
tr_point | object | 右上角坐标 |
tr_point.x | float | X坐标 |
tr_point.y | float | y坐标 |
score | float | 该行文本识别置信度 |
text | string | 文本行文字内容 |
# 常见问题
# 票据卡证识别的主要功能是什么?
答:结构化识别身份证、结婚证、营业执照、驾驶证、户口本等常用25种证件和15种票据;广泛适用于身份认证、金融开户、征信评估、商户入驻等业务场景。
# 票据卡证识别支持什么应用平台?
答:目前支持Web API应用平台。
# 票据卡证识别对图片有什么要求吗?
答:图片格式支持 jpg、jpeg、png、bmp、webp、tiff格式,且需保证图像文件大小base64编码后不超过4MB。