图像文字识别

图像文字识别

*以下为与图像通用识别的 Python示例代码
*#!/usr/bin/env python
#coding=utf-8

from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkocr.request.v20191230.RecognizeCharacterRequest import RecognizeCharacterRequest

client = AcsClient(’’, ‘’, ‘cn-shanghai’)

request = RecognizeCharacterRequest()
request.set_accept_format(‘json’)

request.set_MinHeight(“10”)
request.set_OutputProbability(“true”)
request.set_ImageURL(“https://viapi-test.oss-cn-shanghai.aliyuncs.com/demo-center/ocr/RecognizeCharacter.jpg”)

response = client.do_action_with_exception(request)
print(str(response, encoding=‘utf-8’))

功能描述

RecognizeCharacter可以识别图像中文字内容和文字区域坐标,适用于多场景图像文字识别。

输入限制
请求格式:JPEG、JPG、PNG、BMP、GIF。
图像大小:图像大小不超过3M。
图像分辨率:不限制图片分辨率,但图片分辨率太高可能会导致API识别超时,超时时间为5秒。
URL地址中不能包含中文字符。
调试

JSON模式

http(s)😕/[Endpoint]/?Action=RecognizeCharacter
&ImageURL=https://viapi-test.oss-cn-shanghai.aliyuncs.com/demo-center/ocr/RecognizeCharacter.jpg
&MinHeight=10
&OutputProbability=true
&<公共请求参数>{
“RequestId”: “062A6BA0-40AF-47D4-B2A3-664B1009141F”,
“Data”: {
“Results”: [
{
“TextRectangles”: {
“Left”: 126,
“Angle”: -89,
“Top”: 26,
“Height”: 58,
“Width”: 17
},
“Probability”: “0.99908673763275146”,
“Text”: “6月9日”
},
{
“TextRectangles”: {
“Left”: 124,
“Angle”: -89,
“Top”: -22,
“Height”: 198,
“Width”: 19
},
“Probability”: “0.7280038595199585”,
“Text”: “名企商机干亿市场发布会”
},
{
“TextRectangles”: {
“Left”: 129,
“Angle”: -89,
“Top”: 77,
“Height”: 61,
“Width”: 15
},
“Probability”: “0.99313169717788696”,
“Text”: “邀请函”
},
{
“TextRectangles”: {
“Left”: 72,
“Angle”: -89,
“Top”: 102,
“Height”: 86,
“Width”: 10
},
“Probability”: “0.72483104467391968”,
“Text”: “尊敬的先生/女士嘉宾”
},
{
“TextRectangles”: {
“Left”: 57,
“Angle”: -89,
“Top”: 147,
“Height”: 22,
“Width”: 9
},
“Probability”: “0.62350982427597046”,
“Text”: “您好!”
},
{
“TextRectangles”: {
“Left”: 34,
“Angle”: 0,
“Top”: 167,
“Height”: 9,
“Width”: 204
},
“Probability”: “0.32332202792167664”,
“Text”: “现诚邀请您在临“6月9日名企商机千亿市场发布会”
},
{
“TextRectangles”: {
“Left”: 35,
“Angle”: 0,
“Top”: 206,
“Height”: 14,
“Width”: 113
},
“Probability”: “0.7724418044090271”,
“Text”: “01新采购新趋势”
},
{
“TextRectangles”: {
“Left”: 69,
“Angle”: -89,
“Top”: 188,
“Height”: 76,
“Width”: 7
},
“Probability”: “0.19863292574882507”,
“Text”: “IW PURCHASE 1 1**”
},
{
“TextRectangles”: {
“Left”: 35,
“Angle”: 0,
“Top”: 243,
“Height”: 14,
“Width”: 154
},
“Probability”: “0.82449477910995483”,
“Text”: “02采购供应链+两化融合”
},
{
“TextRectangles”: {
“Left”: 34,
“Angle”: 0,
“Top”: 259,
“Height”: 7,
“Width”: 133
},
“Probability”: “0.23317055404186249”,
“Text”: “PEDCORENERT SUPPLY CEAIR TWO FOSIO”
},
{
“TextRectangles”: {
“Left”: 90,
“Angle”: -89,
“Top”: 223,
“Height”: 125,
“Width”: 14
},
“Probability”: “0.72289299964904785”,
“Text”: “03阳光效益转型”
},
{
“TextRectangles”: {
“Left”: 115,
“Angle”: -89,
“Top”: 236,
“Height”: 202,
“Width”: 10
},
“Probability”: “0.72888237237930298”,
“Text”: “主办单位:网里巴巴(中国)网络技术有限公司”
},
{
“TextRectangles”: {
“Left”: 90,
“Angle”: -89,
“Top”: 290,
“Height”: 121,
“Width”: 9
},
“Probability”: “0.48480159044265747”,
“Text”: “主办部门:大企业采购+诚信通”
},
{
“TextRectangles”: {
“Left”: 72,
“Angle”: -89,
“Top”: 320,
“Height”: 85,
“Width”: 10
},
“Probability”: “0.99824750423431396”,
“Text”: “时间:2017年6月9日”
},
{
“TextRectangles”: {
“Left”: 115,
“Angle”: -89,
“Top”: 285,
“Height”: 182,
“Width”: 9
},
“Probability”: “0.87808668613433838”,
“Text”: “地址:中国浙江省杭州市滨江区网商路699号”
},
{
“TextRectangles”: {
“Left”: 65,
“Angle”: -89,
“Top”: 353,
“Height”: 72,
“Width”: 10
},
“Probability”: “0.77262163162231445”,
“Text”: “阿里巴巴集团总部”
}
]
}
}

阿里云高校计划,陪伴两千多所高校在校生云上实践、云上成长。在这里你可以领用免费的cpu资源,还可以参加免费训练营,实践提高:https://developer.aliyun.com/adc/student/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值