0、pom依赖
<!--Jedis--
>
<dependency
>
<groupId
>redis.clients
</groupId
>
<artifactId
>jedis
</artifactId
>
<version
>3.3.0
</version
>
</dependency
>
<!--腾讯云图文转换工具包--
>
<dependency
>
<groupId
>com.tencentcloudapi
</groupId
>
<artifactId
>tencentcloud-sdk-java
</artifactId
>
<version
>3.1.81
</version
>
</dependency
>
<!--base64coder--
>
<dependency
>
<groupId
>commons-codec
</groupId
>
<artifactId
>commons-codec
</artifactId
>
<version
>1.12
</version
>
</dependency
>
1、获取secretId和secretKey
https://console.cloud.tencent.com/cam/capi 生成密钥 头像下拉框——》帐号信息【进入帐号中心】——》访问管理——》访问密钥——》新建密钥
2、找到对应的简单实现
云产品——》搜索 “通用文字识别”——》右上方的接口文档——》找到点击调试
3、上述内容如果能走通的话开始在idea中编写
基本就网站内容抄一遍
这里我用redis存储 避免重复请求 随便存,Gson解析生成的对象GeneralOCR 可以用GsonFormat生成。alt+s呼出 ,把json放里面放就能生成
base64编码 inputStream读取图片 解析出的json异常 本应为double的现在为int 路径中有中文 可能需要通过URLDecoder解码
百度调用图文识别 tess4j调用图文识别