/*** * @Title: idcard* @Description: 该方法的主要作用:扫描身份证* @param  @return 设定文件  * @return  返回类型:String   * @throws*/public void idcard(){String host = "https://dm-51.data.aliyun.com";String path = "/rest/160601/ocr/ocr_idcard.json";String method = "POST";Map<String, String> headers = new HashMap<String, String>();headers.put("Authorization", "APPCODE " + appcode);headers.put("Content-Type", "application/json; charset=UTF-8");Map<String, String> querys = new HashMap<String, String>();String bodys = "{\"inputs\": [{\"image\": {\"dataType\": 50,\"dataValue\":\""+img+"\"},\"configure\": {\"dataType\": 50,\"dataValue\":\"{\\\"side\\\":\\\"face\\\"}\"}}]}";try {HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);//System.out.println(EntityUtils.toString(response.getEntity()));String result = EntityUtils.toString(response.getEntity());System.out.println(result);JSONObject jObject =  JSONObject.fromObject(result);JSONArray jarray = jObject.optJSONArray("outputs");for (int i = 0; i < jarray.size(); i++) {JSONObject subject =  jarray.getJSONObject(i);String outputValue = subject.get("outputValue").toString();/*outputValue={"dataType": 50,"dataValue": {"address": "山西省xxxx041","birth": "19980908","config_str": "{\"side\":\"face\"}","face_rect": {"angle": -90,"center": {"x": 446,"y": 210},"size": {"height": 92,"width": 84}},"name": "xxx","nationality": "汉","num": "1411251998xxxxxxX","request_id": "20170806200141_c5338b2c4fd601ea7f00c4dcc5c8ee0e","sex": "男","success": true}}*/JSONObject j_outputValue = JSONObject.fromObject(outputValue);String dataValue = j_outputValue.getString("dataValue");JSONObject j_dataValue = JSONObject.fromObject(dataValue);customerInfo = new CustomerInfo();customerInfo.setName(j_dataValue.getString("name").toString());  //姓名String date = j_dataValue.getString("birth").toString();customerInfo.setBorn(date);SimpleDateFormat format = new SimpleDateFormat(date);Date birth = format.parse(date);customerInfo.setBirth(birth);//生日customerInfo.setAddress(j_dataValue.getString("address").toString());customerInfo.setNationality(j_dataValue.getString("nationality").toString());customerInfo.setNum(j_dataValue.getString("num").toString());customerInfo.setSex(j_dataValue.getString("sex").toString());}System.out.println(customerInfo.getName());String jsonc = JSON.toJSONString(customerInfo);HttpServletResponse response1 = ServletActionContext.getResponse();response1.setContentType("text/html;charset=utf-8");PrintWriter out = response1.getWriter();out.print(jsonc);} catch (Exception e) {e.printStackTrace();}}

使用阿里云身份证扫描识别接口案例——CSDN博客相关推荐

  1. 使用阿里云智能翻译接口案例——CSDN博客

    /*** * @Title: getTranslates* @Description: 该方法的主要作用:智能翻译* @param 设定文件 * @return 返回类型:void * @throws ...

  2. 使用阿里云火车票查询接口案例——CSDN博客

    首先我们需要一个实体类,专门放火车票信息的封装类,实体类: Train.java: /** * @Title: Train.java * @Package cn.bdqn.guanMingSys.en ...

  3. Java spring boot 阿里云调用人脸识别接口,本地sdk上传到阿里云调用api

    Java spring boot 阿里云调用人脸识别接口 没有写测试类,工具类如下,有access_key_id和access_key_secret传参调用就可使用 代码如下: pom.xml依赖 & ...

  4. 阿里云服务器安装WordPress,搭建自己的博客网站

    阿里云服务器安装WordPress,搭建自己的博客网站 很多人都想搭建自己的博客网站,如今要实现自己的博客网站已经很简单了.这几天我就尝试了一下,随便记录下来,方便后人. 一个自己的博客网站至少需要这 ...

  5. 阿里云上基于WordPress快速搭建个人博客

    阿里云上基于WordPress快速搭建个人博客 文章目录 阿里云上基于WordPress快速搭建个人博客 一.服务器环境: 二.环境部署: 1.重置实例密码 2.链接ECS服务器 3.安装Apache ...

  6. 手把手教你在阿里云ECS上搭建惊艳的博客

    手把手教你在阿里云ECS上搭建惊艳的博客 相信大多数人都有自己搭建博客网站的想法,本文就手把手一步一步的进行,最终结果类似如下样式: 网站软件的选择 软件选择成熟而免费的WordPress,WordP ...

  7. AI赋能案例—阿里云身份证OCR识别助力实现“无接触”式政务服务!

    2020年初的这场疫情,是一场对突发性公共卫生事件应急处置的大考,也是对数字政务体系能力的检验.在保证不影响办事效率的情况,如何减少人员的接触是政务场景下的"防疫"关键!日前由一窗 ...

  8. ORC工具(使用阿里云统一文字识别接口实现)

    废话不多,直接上代码. public class Text {/*** 使用AK&SK初始化账号Client** @param accessKeyId 阿里云的accessKeyId* @pa ...

  9. 阿里云域名+老薛主机 搭建个人博客网站 小结

    本人将之前写在自己网站的搭建网站过程的文章,搬过来了,要问为啥,因为精力有限,没有时间在自己的网站上折腾^...^ 虽然之前截的图片不能看了,但是不影响你照着本人的博客,自己独立搭建网站. [声明] ...

最新文章

  1. GitHub有趣分享:Thanos(灭霸命令)
  2. Go语言——怎样导入一个外部的包
  3. shiro 解决 跨域(仅端口不同) 登陆 问题
  4. python下载过程中最后一步执行opencv出错怎么回事_如何修复python中opencv中的错误“QObject::moveToThread:”?...
  5. 会计电算化的重要物质基础计算机和,湖北工业大学工程技术学院会计电算化管理办法...
  6. Kubernetes operator 模式开发实践
  7. erwin 不能输入中文_国产开源建模软件PDMan与国外商业建模软件ERwin的主要功能比较...
  8. tomcat6配置log4j日志
  9. 在delphi中嵌入腳本語言--(譯)RemObjects Pascal Script使用說明(1)(譯)
  10. vue中组件的导出导入_5.2 vue中 keep-alive 组件的作用,详细解释keep-alive使用方法...
  11. dp4--codeVs1043 方格取数
  12. 程序员转型架构师,推荐你读这几本书
  13. Atitit j2ee5 jee5 j2ee6 j2ee7 jee6 jee7 新特性
  14. 跨平台客户端开发经验总结
  15. Linux系统教学-Lesson01
  16. 微信支付商户平台 —公立医院申请
  17. 计算机网络13--网络应用的体系结构
  18. [Poi2003 ][bzoj 2601]MAL猴子捞月
  19. python中.mul()和.mul_(),.exp()和.exp_()区别
  20. 在win7下制作MAC启动u盘

热门文章

  1. 宜人贷财报高质量增长背后:本心与精进并行
  2. LCD显示--HT1621b芯片驱动程序
  3. 7、数组越界异常捕获
  4. spring中aop拦截自定义注解不生效
  5. GreenDao使用
  6. 讨教大学|聊聊可靠性工程师的就业前景怎么样?
  7. 购物小票java代码
  8. django入门操作3
  9. 讯飞语音转文字_科大讯飞发布新一代语音转文字录音笔,开启个人高效记录时代...
  10. 为什么发电机要用D45XT100-ASEMI三相整流桥