阿里接口平台--印刷字识别_身份证识别API接口phpdemo使用
来源:互联网 发布:手机cpu实时数据 编辑:程序博客网 时间:2024/04/29 15:25
一.打开阿里云官网
二.找到API市场的印刷文字识别_身份证识别
三.注册账号,花1分钱购买使用
四.记下appcode,我使用的是php演示接口请求
<?php $host = "https://dm-51.data.aliyun.com"; $path = "/rest/160601/ocr/ocr_idcard.json"; $method = "POST"; $appcode = "06a76442d3da4685bdd6cb7b0e4f3";//此处是你购买后系统提供的code $headers = array(); array_push($headers, "Authorization:APPCODE " . $appcode); //根据API的要求,定义相对应的Content-Type array_push($headers, "Content-Type".":"."application/json; charset=UTF-8");$base_mage = base64_encode(file_get_contents('sfz.jpg'));//sfz.jpg为身份证图片路径,此处默认在同级目录 $querys = ""; $bodys = "{ \"inputs\": [ { \"image\": { \"dataType\": 50, \"dataValue\": \"$base_mage\" }, \"configure\": { \"dataType\": 50, \"dataValue\": \"{\\\"side\\\":\\\"face\\\"}\" } } ]}"; $url = $host . $path; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); if (1 == strpos("$".$host, "https://")) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);$res = curl_exec($curl);echo "<pre>"; print_r($res);?>
五.运行程序在浏览器查看结果
六.一些细节
1,正反面识别,要改动请求参数中的face
{ "inputs": [ { "image": { "dataType": 50, "dataValue": "图片二进制数据的base64编码" }, "configure": { "dataType": 50, "dataValue": "{\"side\":\"face\"}" #身份证正反面类型:face/back } } ]}
2,结果说明
正面返回结果:{ "outputs": [ { "outputLabel": "ocr_id", "outputMulti": {}, "outputValue": { "dataType": 50, "dataValue": "{ \"address\" : \"浙江省杭州市余杭区文一西路969号\", #地址信息 \"config_str\" : \"{\\\"side\\\":\\\"face\\\"}\", #配置信息,同输入configure \"face_rect\":{ \"angle\": -90, \"center\":{ \"x\" : 952, \"y\" : 325.5 }, \"size\":{ \"height\":181.99, \"width\":164.99 } }, #人脸位置,center表示人脸矩形中心坐标,size表示人脸矩形长宽,angle表示矩形顺时针旋转的度数。 \"name\" : \"张三\", #姓名 \"nationality\": \"汉\", #民族 \"num\" : \"1234567890\", #身份证号 \"sex\" : \"男\", #性别 \"birth\" : \"20000101\", #出生日期 \"nationality\" : \"汉\", #民族 \"success\" : true #识别结果,true表示成功,false表示失败 }" } }]}反面返回结果:{ "outputs": [ { "outputLabel": "ocr_id", "outputMulti": {}, "outputValue": { "dataType": 50, "dataValue": "{ \"config_str\" : \"{\\\"side\\\":\\\"back\\\"}\",#配置信息,同输入configure \"start_date\" : \"19700101\", #有效期起始时间 \"end_date\" : \"19800101\", #有效期结束时间 \"issue\" : \"杭州市公安局\", #签发机关 \"success\" : true #识别结果,true表示成功,false表示失败 }" } }]}
阅读全文
0 0
- 阿里接口平台--印刷字识别_身份证识别API接口phpdemo使用
- Android平台上实现身份证识别(通过阿里云Api-印刷文字识别_身份证识别)
- Android平台上实现银行卡识别(通过阿里云Api-印刷文字识别_银行卡识别)
- 使用阿里身份证识别接口(使用appkey和secret)
- 调用阿里云身份证识别接口(使用appcode方式)
- 使用阿里云身份证扫描识别接口案例——CSDN博客
- Python3调用face++免费API接口识别身份证信息
- Android/iOS身份证识别SDK/开发包/API/接口
- AI-Android/iOS身份证识别SDK/开发包/API/接口
- 阿里云 OCR身份证识别Api 使用(一)
- 阿里云 OCR身份证识别Api 使用(二)
- 使用face++的API接口-手势识别
- 营业执照识别api接口调用OCR识别
- 行驶证识别API接口
- H5证件识别API/接口
- 身份证图像识别api
- 微信公众平台消息接口开发(24)图片识别之人脸识别API
- 微信公众平台消息接口开发(24)图片识别之人脸识别API
- Chrome快捷键
- POJ2777
- 基数排序
- CEF3:CEF3多进程
- JAVA 实现 HTTP 断点续传及原理
- 阿里接口平台--印刷字识别_身份证识别API接口phpdemo使用
- Java设计模式之观察者模式
- selenium+python自动化测试笔记
- 微信扫码支付模式一和模式二的区别
- Maven学习总结(八)——使用Maven构建多模块项目
- Visual Studio error C2001:常量中有换行符(解决办法)
- JVM指令集合
- unity移动平台路径问题
- 设置导航栏下划线