OCR文字识别
使用场景:
对于电商中的分销机制,是需要用户上传身份证或者银行卡的,由于身份证号码(18位/15位),银行卡(19位/17位/16位),位数较多,在用户输入时,有些繁琐。
以支付宝绑定银行卡为例,可以通过拍照的方式,自动检测银行卡中的卡号信息,如果有错误的数字,还可以进行二次修改。
身份证的信息也是如此,此时就需要用到OCR文字识别。
百度/腾讯/阿里 都有OCR
百度OCR网址:/ai-doc/OCR/rk3h7xzck
接口描述
支持对二代居民身份证正反面所有8个字段进行结构化识别,包括姓名、性别、民族、出生日期、住址、身份证号、签发机关、有效期限,识别准确率超过99%;同时支持身份证正面头像检测,并返回头像切片的base64编码及位置信息。
同时,支持对用户上传的身份证图片进行图像风险和质量检测,可识别图片是否为复印件或临时身份证,是否被翻拍或编辑,是否存在正反颠倒、模糊、欠曝、过曝等质量问题。
请求说明
请求示例
HTTP 方法:POST
请求URL: /rest/2.0/ocr/v1/idcard
URL参数:
参数 值
access_token 通过API Key和Secret Key获取的access_token,参考“Access Token获取”
Header如下:
参数 值
Content-Type application/x-www-form-urlencoded
Body中放置请求参数,参数详情如下:
请求参数
请求代码示例
提示一:使用示例代码前,请记得替换其中的示例Token、图片地址或Base64信息。
返回说明
返回参数
返回示例
{"log_id": 2648325511,"direction": 0,"image_status": "normal","idcard_type": "normal","edit_tool": "Adobe Photoshop CS3 Windows","photo": "/9j/4AAQSkZJRgABA......","photo_location": {"width": 1189,"top": 638,"left": 2248,"height": 1483},"words_result": {"住址": {"location": {"left": 267,"top": 453,"width": 459,"height": 99},"words": "南京市江宁区弘景大道3889号"},"公民身份号码": {"location": {"left": 443,"top": 681,"width": 589,"height": 45},"words": "330881199904173914"},"出生": {"location": {"left": 270,"top": 355,"width": 357,"height": 45},"words": "19990417"},"姓名": {"location": {"left": 267,"top": 176,"width": 152,"height": 50},"words": "伍云龙"},"性别": {"location": {"left": 269,"top": 262,"width": 33,"height": 52},"words": "男"},"民族": {"location": {"left": 492,"top": 279,"width": 30,"height": 37},"words": "汉"}},"words_result_num": 6}