阿里云OCR图片文字识别使用教程

第一步: 租赁阿里云OCR文字识别服务
购买阿里云-OCR文字识别接口
第二步: 购买服务后会对应的 appCode
在购物OCR服务后对应的appCode
第三步: 使用aliyun提供的接口

package io.renren;import io.renren.utils.HttpUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;import java.util.*;/*** @author yww* @createTime 2021/4/25*/
public class TestMain {public static void main(String[] args){//图片url地址String imgUrl = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fn.sinaimg.cn%2Ffront20200423ac%2F40%2Fw1080h2160%2F20200423%2Ff7f9-isqivxh6293901.jpg&refer=http%3A%2F%2Fn.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1623824738&t=9c9b7f95a7639f16939d8de2c70102f5";aliyunAnalysisPic(imgUrl);}/*** OCR文字识别* @param img 图片地址*/public static void aliyunAnalysisPic(String img){String host = "https://ocrapi-advanced.taobao.com";String path = "/ocrservice/advanced";String method = "POST";//自己的appCodeString appcode = "*******************";Map<String, String> headers = new HashMap<String, String>();//最后在header中的格式(中间是英文空格)为Authorization:APPCODE ****************headers.put("Authorization", "APPCODE " + appcode);//根据API的要求,定义相对应的Content-Typeheaders.put("Content-Type", "application/json; charset=UTF-8");Map<String, String> querys = new HashMap<String, String>();String bodys = "{\"img\":\"\",\"url\":\""+img+"\",\"prob\":false,\"charInfo\":false,\"rotate\":false,\"table\":false}";try {/*** 重要提示如下:* HttpUtils请从* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java* 下载** 相应的依赖请参照* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml*/HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);System.out.println(response.toString());//获取response的bodySystem.out.println(EntityUtils.toString(response.getEntity()));} catch (Exception e) {e.printStackTrace();}}
}

图片原型 (此图片为百度搜索得到):
在这里插入图片描述
执行结果:

{"sid":"4dc1805f72f335effddca7278454a2c68ca5b484c4c652cf3d6a1beb2be23e2051e0fda7","prism_version":"1.0.9","prism_wnum":43,"prism_wordsInfo":[{"word":"仅限紧急呼叫×","pos":[{"x":39,"y":6},{"x":210,"y":7},{"x":210,"y":34},{"x":39,"y":33}],"direction":0,"angle":-89,"x":110,"y":-66,"width":28,"height":171},{"word":"4G","pos":[{"x":220,"y":15},{"x":251,"y":15},{"x":251,"y":36},{"x":220,"y":36}],"direction":0,"angle":-90,"x":225,"y":9,"width":22,"height":31},{"word":"74","pos":[{"x":910,"y":24},{"x":942,"y":24},{"x":942,"y":44},{"x":910,"y":44}],"direction":0,"angle":-90,"x":915,"y":18,"width":21,"height":32},{"word":"11:22","pos":[{"x":967,"y":20},{"x":1045,"y":23},{"x":1044,"y":54},{"x":966,"y":50}],"direction":0,"angle":-87,"x":991,"y":-1,"width":30,"height":78},{"word":"中国电信","pos":[{"x":38,"y":40},{"x":131,"y":40},{"x":131,"y":67},{"x":38,"y":67}],"direction":0,"angle":-90,"x":71,"y":6,"width":27,"height":93},{"word":"1.l","pos":[{"x":221,"y":36},{"x":266,"y":36},{"x":266,"y":55},{"x":221,"y":55}],"direction":0,"angle":-90,"x":234,"y":23,"width":20,"height":44},{"word":"09","pos":[{"x":289,"y":36},{"x":321,"y":27},{"x":326,"y":46},{"x":294,"y":55}],"direction":0,"angle":-14,"x":290,"y":30,"width":33,"height":19},{"word":"订单详情","pos":[{"x":441,"y":125},{"x":638,"y":127},{"x":638,"y":169},{"x":441,"y":168}],"direction":0,"angle":-89,"x":518,"y":48,"width":43,"height":198},{"word":"买家付款","pos":[{"x":44,"y":255},{"x":189,"y":255},{"x":189,"y":289},{"x":44,"y":289}],"direction":0,"angle":-90,"x":100,"y":200,"width":34,"height":144},{"word":"商家发货","pos":[{"x":476,"y":255},{"x":621,"y":255},{"x":621,"y":288},{"x":476,"y":288}],"direction":0,"angle":0,"x":476,"y":255,"width":146,"height":34},{"word":"交易完成","pos":[{"x":887,"y":256},{"x":1034,"y":256},{"x":1034,"y":288},{"x":887,"y":288}],"direction":0,"angle":-90,"x":944,"y":199,"width":32,"height":147},{"word":"司","pos":[{"x":44,"y":429},{"x":105,"y":429},{"x":105,"y":476},{"x":44,"y":476}],"direction":0,"angle":0,"x":44,"y":429,"width":60,"height":45},{"word":"【已签收】","pos":[{"x":138,"y":431},{"x":298,"y":431},{"x":298,"y":469},{"x":138,"y":469}],"direction":0,"angle":0,"x":138,"y":431,"width":158,"height":36},{"word":"【温州市】","pos":[{"x":361,"y":430},{"x":524,"y":430},{"x":524,"y":469},{"x":361,"y":469}],"direction":0,"angle":0,"x":360,"y":431,"width":163,"height":37},{"word":"您的快件已送达淘宝仓","pos":[{"x":541,"y":430},{"x":975,"y":432},{"x":975,"y":470},{"x":541,"y":468}],"direction":0,"angle":-89,"x":739,"y":232,"width":38,"height":434},{"word":"库2保管,地址:江省温州市瑞安市白象村博汇轿","pos":[{"x":115,"y":491},{"x":998,"y":488},{"x":998,"y":529},{"x":115,"y":531}],"direction":0,"angle":0,"x":114,"y":489,"width":883,"height":40},{"word":"车快修中心对面,如有疑问请电联快递员:谭光","pos":[{"x":115,"y":550},{"x":963,"y":550},{"x":963,"y":590},{"x":115,"y":590}],"direction":0,"angle":-89,"x":520,"y":145,"width":38,"height":849},{"word":"明【18058396060】。相逢是缘,如果您对我的","pos":[{"x":115,"y":610},{"x":976,"y":612},{"x":976,"y":652},{"x":115,"y":650}],"direction":0,"angle":-89,"x":525,"y":200,"width":39,"height":861},{"word":"服务感到满意,给个五星好不好?","pos":[{"x":115,"y":671},{"x":691,"y":671},{"x":691,"y":709},{"x":115,"y":709}],"direction":0,"angle":-89,"x":383,"y":401,"width":37,"height":576},{"word":"【请在评价小件","pos":[{"x":717,"y":671},{"x":984,"y":671},{"x":984,"y":709},{"x":717,"y":709}],"direction":0,"angle":-90,"x":832,"y":556,"width":38,"height":267},{"word":"员处给予五星好评】","pos":[{"x":116,"y":730},{"x":466,"y":732},{"x":466,"y":770},{"x":116,"y":769}],"direction":0,"angle":-89,"x":272,"y":574,"width":38,"height":351},{"word":"o","pos":[{"x":486,"y":750},{"x":512,"y":750},{"x":512,"y":771},{"x":486,"y":771}],"direction":0,"angle":-90,"x":490,"y":748,"width":20,"height":26},{"word":"2020-04-1511:24:35","pos":[{"x":111,"y":821},{"x":445,"y":821},{"x":445,"y":851},{"x":111,"y":851}],"direction":0,"angle":-89,"x":263,"y":668,"width":29,"height":335},{"word":"收货人:屈文艳","pos":[{"x":113,"y":950},{"x":407,"y":950},{"x":407,"y":987},{"x":113,"y":987}],"direction":0,"angle":-89,"x":242,"y":821,"width":36,"height":295},{"word":"18117358039","pos":[{"x":770,"y":954},{"x":1034,"y":954},{"x":1034,"y":986},{"x":770,"y":986}],"direction":0,"angle":-90,"x":886,"y":839,"width":32,"height":264},{"word":"收货地址:","pos":[{"x":113,"y":1036},{"x":275,"y":1036},{"x":275,"y":1068},{"x":113,"y":1068}],"direction":0,"angle":-90,"x":178,"y":969,"width":32,"height":163},{"word":"上海市闵行区浦江镇6组33号申通代售点","pos":[{"x":282,"y":1036},{"x":931,"y":1036},{"x":931,"y":1071},{"x":282,"y":1071}],"direction":0,"angle":-89,"x":589,"y":727,"width":34,"height":650},{"word":"一","pos":[{"x":332,"y":1114},{"x":367,"y":1114},{"x":367,"y":1138},{"x":332,"y":1138}],"direction":0,"angle":-90,"x":338,"y":1108,"width":25,"height":35},{"word":"一","pos":[{"x":641,"y":1118},{"x":661,"y":1118},{"x":661,"y":1138},{"x":641,"y":1138}],"direction":0,"angle":-90,"x":641,"y":1118,"width":21,"height":20},{"word":"一","pos":[{"x":988,"y":1113},{"x":1017,"y":1113},{"x":1017,"y":1135},{"x":988,"y":1135}],"direction":0,"angle":-90,"x":992,"y":1110,"width":22,"height":28},{"word":"精英鹿旗舰店","pos":[{"x":115,"y":1210},{"x":366,"y":1212},{"x":366,"y":1249},{"x":115,"y":1247}],"direction":0,"angle":-89,"x":222,"y":1102,"width":36,"height":253},{"word":"(男+女)","pos":[{"x":357,"y":1334},{"x":481,"y":1334},{"x":481,"y":1367},{"x":357,"y":1367}],"direction":0,"angle":-89,"x":402,"y":1288,"width":33,"height":124},{"word":"美国苹果反光条休闲老爹鞋-...","pos":[{"x":485,"y":1332},{"x":977,"y":1334},{"x":977,"y":1370},{"x":485,"y":1367}],"direction":0,"angle":-89,"x":712,"y":1104,"width":35,"height":493},{"word":"白色40码,白色37码","pos":[{"x":336,"y":1390},{"x":648,"y":1390},{"x":648,"y":1422},{"x":336,"y":1422}],"direction":0,"angle":-89,"x":475,"y":1249,"width":32,"height":312},{"word":"¥158.00","pos":[{"x":333,"y":1540},{"x":495,"y":1541},{"x":495,"y":1576},{"x":333,"y":1574}],"direction":0,"angle":-88,"x":395,"y":1476,"width":34,"height":163},{"word":"x1","pos":[{"x":990,"y":1546},{"x":1029,"y":1546},{"x":1029,"y":1572},{"x":990,"y":1572}],"direction":0,"angle":-90,"x":995,"y":1540,"width":27,"height":39},{"word":"退款中","pos":[{"x":911,"y":1641},{"x":1006,"y":1641},{"x":1006,"y":1670},{"x":911,"y":1670}],"direction":0,"angle":-90,"x":942,"y":1608,"width":30,"height":95},{"word":"商品小计:¥158.00","pos":[{"x":667,"y":1763},{"x":1032,"y":1760},{"x":1032,"y":1798},{"x":667,"y":1801}],"direction":0,"angle":0,"x":666,"y":1761,"width":365,"height":39},{"word":"评价","pos":[{"x":414,"y":1953},{"x":487,"y":1953},{"x":487,"y":1986},{"x":414,"y":1986}],"direction":0,"angle":-89,"x":434,"y":1933,"width":32,"height":73},{"word":"再来一单","pos":[{"x":598,"y":1953},{"x":744,"y":1953},{"x":744,"y":1985},{"x":598,"y":1985}],"direction":0,"angle":-90,"x":654,"y":1897,"width":32,"height":146},{"word":"我要晒订单","pos":[{"x":826,"y":1953},{"x":1007,"y":1953},{"x":1007,"y":1985},{"x":826,"y":1985}],"direction":0,"angle":-90,"x":900,"y":1879,"width":32,"height":182},{"word":"黑","pos":[{"x":930,"y":2062},{"x":1033,"y":2073},{"x":1028,"y":2121},{"x":925,"y":2111}],"direction":0,"angle":-84,"x":953,"y":2039,"width":49,"height":104},{"word":"BLACKCAT","pos":[{"x":920,"y":2131},{"x":1070,"y":2131},{"x":1070,"y":2154},{"x":920,"y":2154}],"direction":0,"angle":-90,"x":983,"y":2068,"width":22,"height":150}],"height":2160,"width":1080,"orgHeight":2160,"orgWidth":1080,"content":"仅限紧急呼叫× 4G 74 11:22 中国电信 1.l 09 订单详情 买家付款 商家发货 交易完成 司 【已签收】 【温州市】 您的快件已送达淘宝仓 库2保管,地址:江省温州市瑞安市白象村博汇轿 车快修中心对面,如有疑问请电联快递员:谭光 明【18058396060】。相逢是缘,如果您对我的 服务感到满意,给个五星好不好? 【请在评价小件 员处给予五星好评】 o 2020-04-1511:24:35 收货人:屈文艳 18117358039 收货地址: 上海市闵行区浦江镇6组33号申通代售点 一 一 一 精英鹿旗舰店 (男+女) 美国苹果反光条休闲老爹鞋-... 白色40码,白色37码 ¥158.00 x1 退款中 商品小计:¥158.00 评价 再来一单 我要晒订单 黑 BLACKCAT "}

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/42203.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Android Rxjava教程:清晰 简洁 易懂的Rxjava入门教程

前言 Rxjava由于其基于事件流的链式调用、逻辑简洁 & 使用简单的特点&#xff0c;深受各大 Android开发者的欢迎。 image 本文主要&#xff1a; 面向 刚接触Rxjava的初学者提供了一份 清晰、简洁、易懂的Rxjava入门教程 涵盖 基本介绍、原理 & 具体使用等 解决的是初学…

Revit2018下载和安装教程

Revit2018下载地址&#xff1a;https://pan.baidu.com/s/1YMUfuRs1sd3B6wEL5y9EZg 下载方法&#xff1a;复制下载链接&#xff0c;粘贴至浏览器网址栏打开&#xff0c;点击保存到网盘&#xff0c;打开网盘客户端&#xff0c;找到刚保存的Revit安装包&#xff0c;下载到电脑上&a…

水壶接水烧水教程

写一下前因后果&#xff0c;是个不错的故事 起因 公司一直有免费的大桶水供应&#xff0c;直到那一天&#xff0c;负责此事的尹经理涉嫌学历造假&#xff0c;被开除&#xff0c;大桶水断供。 初步解决 虽然没有大桶水&#xff0c;但同学们总是要喝水的&#xff0c;总买小瓶…

AI2019下载Adobe Illustrator CC2019安装教程

Illustrator&#xff08;简称“AI”&#xff09;是一款非常强大的矢量图制图软件&#xff0c;在平面设计、UI设计、广告设计等诸多行业都有广泛的应用&#xff0c;并且作为必备软件有它的不可替代性&#xff1b; 但很多朋友在开始安装AI软件的时候却遇到种种困难&#xff0c;为…

android轮播图实现方案,Android轮播图实现教程

ListView的headerView设置为轮播图之后结合上/下拉刷新/加载的模式成为现在大多数APP的一个必须具备的功能,对于许多初学者来说想要实现轮播图这样一个集线程睡眠、自动处理、替换过程中刷新UI界面的组合功能非常困难,没有思路,感觉无从下手,去搜索各种实现方案,发现目前充…

PS2015下载PSCC2015安装教程

PSCC2015&#xff08;64位&#xff09;下载链接&#xff1a;https://pan.baidu.com/s/1FTRjQmYaDgaJVQZtO7vT0w PSCC2015&#xff08;32位&#xff09;下载链接&#xff1a;https://pan.baidu.com/s/1FsJ8wq9tdcbjnjv55tqDaA PSCC2015.5&#xff08;64位&#xff09;下载链接&a…

Elasticsearch教程应用场景

Elasticsearch 使用 1. 搜索使用 1.1 搜索请求的结构体 现在我们已经看到了一些基本知识&#xff0c;让我们尝试一下更加真实的数据集&#xff08;结构化数据&#xff09;。我准备了关于金庸先生的小 说的 JSON 文档样本。每个文档都有以下模式&#xff1a; // 样本一 { …

3dmax2009下载3dmax2009安装教程

3dmax2009&#xff08;32/64位&#xff09;下载&#xff1a;https://pan.baidu.com/s/1SarHkl3RCxeqSVBnYHG8XA 【安装包下载方法】&#xff1a;复制下载链接&#xff0c;粘贴至浏览器网址栏&#xff08;非搜索框哈&#xff09;打开&#xff0c;无提取码&#xff0c;保存至网盘…

Spring Cloud入门到实战系列教程

本教程由猿天地尹吉欢进行整理&#xff0c;欢迎大家转载分享&#xff0c;请注明文章出处。 文章对应源码地址&#xff1a;https://github.com/yinjihuan/spring-cloud #Spring Cloud Eureka Spring Cloud Eureka 初探 Spring Cloud Eureka 增加权限认证 Spring Cloud Eureka …

代码审查软件 Gerrit的安装教程

一、简单介绍 Gerrit&#xff0c;一种免费、开放源代码的代码审查软件&#xff0c;使用网页界面。利用网页浏览器&#xff0c;同一个团队的软件程序员可以相互审阅彼此修改后的程序代码&#xff0c;决定是否能够提交&#xff0c;退回或者继续修改。 二、软件安装 需要安装的环…

Typora导出word文件教程

使用typora可能会遇到需要导出word文件的需求。我们在typora中进行如下操作 如果你是第一次导出word文件&#xff0c;那么他会提示你让你安装pandoc这样一个插件&#xff0c;我提供一个地址 各种操作系统的的pandoc插件我都放在这里面&#xff0c;window系统一般下载倒数第二个…

PS2018下载PSCC2018安装教程

PSCC2018&#xff08;64位&#xff09;下载链接&#xff1a;https://pan.baidu.com/s/1gV9RmsgUdeJ8AXwMXo9aaQ 【下载方法】复制下载链接&#xff0c;粘贴纸浏览器网址栏&#xff08;无提取码&#xff09;打开&#xff0c;保存到网盘&#xff0c;打开网盘客户端&#xff0c;下…

搭建网站教程

建立一个属于自己的网站大致分为以下几个流程 一.购买域名 1.首先来到阿里云&#xff0c;搜一个你想要买的网址 2.来到这一个界面后选择一个域名进行购买 后到域名列表&#xff0c;此处可以看到你已经购买的域名。 点击未实名认证&#xff0c;进入实名认证界面完善自己信息&…

Spring Boot入门到实战系列教程

本教程由猿天地尹吉欢进行整理&#xff0c;欢迎大家转载分享&#xff0c;请注明文章出处。 #Spring Boot 相关课程推荐&#xff1a; Spring Boot从入门到精通课程 Spring Boot Web开发前端性能调优 从零开始手写百度云盘搜索系统实战课程 spring boot开发rest api实战课程 …

微服务中的短信服务如何设计?

发送短信功能&#xff0c;在开发过程中是最常见的需求。用户登录验证码的发送&#xff0c;活动促销短信的发送等。本Chat将带领你深入的去学习如何设计和实现一个通用的基础短信服务&#xff0c;采用Spring Boot开发短信服务&#xff0c;最终会注册到Spring Cloud微服务体系中&…

Revit2020下载Revit2020安装教程

Revit2020下载地址&#xff1a;https://pan.baidu.com/s/11Y4CMBlyY3XiUp4-YRWTdA 下载方法&#xff1a;复制下载链接&#xff0c;粘贴至浏览器网址栏打开&#xff0c;点击保存到网盘&#xff0c;打开百度网盘客户端&#xff0c;找到刚保存的Revit安装包&#xff0c;下载到电脑…

内网穿透NPS使用教程

下载NPS相关的服务端安装包、客户端安装包&#xff08;选择版本号为&#xff1a;v0.26.9&#xff09;&#xff1b; 下载地址&#xff1a;Releases ehang-io/nps GitHub 备注&#xff1a;NPS使用相关官网文档地址&#xff1a;Document nps服务端安装说明&#xff1a; 1、在…

PSCS6下载和安装教程

PS CS6&#xff08;64位32位&#xff09;下载链接&#xff1a;https://pan.baidu.com/s/1z0qqFvZTKJHJ2NdJHGAvjA 【下载方法】复制下载链接&#xff0c;粘贴纸浏览器网址栏&#xff08;无提取码&#xff09;打开&#xff0c;保存到网盘&#xff0c;打开网盘客户端&#xff0c;…

湖北省智能科教研究会走进璞华,调研璞公英教学平台个性化教学新模式

2023年5月9日&#xff0c;热烈祝贺湖北省智能科教研究会红5月智能科教走进璞华集团活动圆满成功。会议上&#xff0c;大家畅所欲言&#xff0c;对教育体制改革与教育信息化产品创新&#xff0c;科技成果转化、产教融合、资源互补、学生能力培养等方面展开充分沟通和探讨。 5月9…

【PTA~21年GPLT团体程序天梯赛-L1题】

文章目录 L1-01 人与神~5题解 L1-02 两小时学完C语言~5题解 L1-03 强迫症~10题解 L1-04 降价提醒机器人~10题解 L1-05 大笨钟的心情~15题解 L1-06 吉老师的回归~15题解 L1-07 天梯赛的善良~20题解 L1-08 乘法口诀数列~20题解 持续更新中...每日一言&#xff1a; login登陆系统~…