本文档介绍通用识别RecognizeCharacter的语法及示例。
功能描述
RecognizeCharacter可以识别图像中文字内容和文字区域坐标,适用于多场景图像文字识别。
前提条件
输入限制
- 请求格式:JPEG、JPG、PNG、BMP、GIF。
- 图像大小:图像大小不超过3M。
- 图像分辨率:不限制图片分辨率,但图片分辨率太高可能会导致API识别超时,超时时间为5秒。
- URL地址中不能包含中文字符。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | RecognizeCharacter |
要执行的操作。取值:RecognizeCharacter。 |
ImageURL | String | 是 | https://viapi-test.oss-cn-shanghai.aliyuncs.com/demo-center/ocr/RecognizeCharacter.jpg |
图片URL地址。当前仅支持上海地域的OSS链接,如何生成URL请参见生成URL。 |
MinHeight | Integer | 是 | 10 |
图片中文字的最小高度,单位像素。 |
OutputProbability | Boolean | 是 | true |
是否输出文字框的概率。取值true或者false。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Data | Struct |
返回的结果数据内容。 |
|
Results | Array of Result |
返回识别信息。 |
|
Probability | Float | 0.99908673763275146 |
文字内容的概率,取值范围为0~1。 |
Text | String | 6月9日 |
文字内容。 |
TextRectangles | Struct |
文字框区域位置。 |
|
Angle | Integer | -89 |
文字区域角度,角度范围 |
Height | Integer | 58 |
文字区域高度。 |
Left | Integer | 126 |
文字区域左上角x坐标。 |
Top | Integer | 26 |
文字区域左上角y坐标。 |
Width | Integer | 17 |
文字区域宽度。 |
RequestId | String | 062A6BA0-40AF-47D4-B2A3-664B1009141F |
请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=RecognizeCharacter
&ImageURL=https://viapi-test.oss-cn-shanghai.aliyuncs.com/demo-center/ocr/RecognizeCharacter.jpg
&MinHeight=10
&OutputProbability=true
&<公共请求参数>
正常返回示例
XML
格式
<RequestId>062A6BA0-40AF-47D4-B2A3-664B1009141F</RequestId>
<Data>
<Results>
<TextRectangles>
<Left>126</Left>
<Angle>-89</Angle>
<Top>26</Top>
<Height>58</Height>
<Width>17</Width>
</TextRectangles>
<Probability>0.99908673763275146</Probability>
<Text>6月9日</Text>
</Results>
<Results>
<TextRectangles>
<Left>124</Left>
<Angle>-89</Angle>
<Top>-22</Top>
<Height>198</Height>
<Width>19</Width>
</TextRectangles>
<Probability>0.7280038595199585</Probability>
<Text>名企商机干亿市场发布会</Text>
</Results>
<Results>
<TextRectangles>
<Left>129</Left>
<Angle>-89</Angle>
<Top>77</Top>
<Height>61</Height>
<Width>15</Width>
</TextRectangles>
<Probability>0.99313169717788696</Probability>
<Text>邀请函</Text>
</Results>
<Results>
<TextRectangles>
<Left>72</Left>
<Angle>-89</Angle>
<Top>102</Top>
<Height>86</Height>
<Width>10</Width>
</TextRectangles>
<Probability>0.72483104467391968</Probability>
<Text>尊敬的先生/女士嘉宾</Text>
</Results>
<Results>
<TextRectangles>
<Left>57</Left>
<Angle>-89</Angle>
<Top>147</Top>
<Height>22</Height>
<Width>9</Width>
</TextRectangles>
<Probability>0.62350982427597046</Probability>
<Text>您好!</Text>
</Results>
<Results>
<TextRectangles>
<Left>34</Left>
<Angle>0</Angle>
<Top>167</Top>
<Height>9</Height>
<Width>204</Width>
</TextRectangles>
<Probability>0.32332202792167664</Probability>
<Text>现诚邀请您在临“6月9日名企商机千亿市场发布会</Text>
</Results>
<Results>
<TextRectangles>
<Left>35</Left>
<Angle>0</Angle>
<Top>206</Top>
<Height>14</Height>
<Width>113</Width>
</TextRectangles>
<Probability>0.7724418044090271</Probability>
<Text>01新采购新趋势</Text>
</Results>
<Results>
<TextRectangles>
<Left>69</Left>
<Angle>-89</Angle>
<Top>188</Top>
<Height>76</Height>
<Width>7</Width>
</TextRectangles>
<Probability>0.19863292574882507</Probability>
<Text>*IW PURCHASE 1 1***</Text>
</Results>
<Results>
<TextRectangles>
<Left>35</Left>
<Angle>0</Angle>
<Top>243</Top>
<Height>14</Height>
<Width>154</Width>
</TextRectangles>
<Probability>0.82449477910995483</Probability>
<Text>02采购供应链+两化融合</Text>
</Results>
<Results>
<TextRectangles>
<Left>34</Left>
<Angle>0</Angle>
<Top>259</Top>
<Height>7</Height>
<Width>133</Width>
</TextRectangles>
<Probability>0.23317055404186249</Probability>
<Text>PEDCORENERT SUPPLY CEAIR TWO FOSIO</Text>
</Results>
<Results>
<TextRectangles>
<Left>90</Left>
<Angle>-89</Angle>
<Top>223</Top>
<Height>125</Height>
<Width>14</Width>
</TextRectangles>
<Probability>0.72289299964904785</Probability>
<Text>03阳光效益转型</Text>
</Results>
<Results>
<TextRectangles>
<Left>115</Left>
<Angle>-89</Angle>
<Top>236</Top>
<Height>202</Height>
<Width>10</Width>
</TextRectangles>
<Probability>0.72888237237930298</Probability>
<Text>主办单位:网里巴巴(中国)网络技术有限公司</Text>
</Results>
<Results>
<TextRectangles>
<Left>90</Left>
<Angle>-89</Angle>
<Top>290</Top>
<Height>121</Height>
<Width>9</Width>
</TextRectangles>
<Probability>0.48480159044265747</Probability>
<Text>主办部门:大企业采购+诚信通</Text>
</Results>
<Results>
<TextRectangles>
<Left>72</Left>
<Angle>-89</Angle>
<Top>320</Top>
<Height>85</Height>
<Width>10</Width>
</TextRectangles>
<Probability>0.99824750423431396</Probability>
<Text>时间:2017年6月9日</Text>
</Results>
<Results>
<TextRectangles>
<Left>115</Left>
<Angle>-89</Angle>
<Top>285</Top>
<Height>182</Height>
<Width>9</Width>
</TextRectangles>
<Probability>0.87808668613433838</Probability>
<Text>地址:中国浙江省杭州市滨江区网商路699号</Text>
</Results>
<Results>
<TextRectangles>
<Left>65</Left>
<Angle>-89</Angle>
<Top>353</Top>
<Height>72</Height>
<Width>10</Width>
</TextRectangles>
<Probability>0.77262163162231445</Probability>
<Text>阿里巴巴集团总部</Text>
</Results>
</Data>
JSON
格式
{
"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": "阿里巴巴集团总部"
}
]
}
}
错误码
关于通用识别的错误码,详情请参见常见错误码。
SDK参考
阿里云视觉AI能力支持使用SDK调用,具体可参见SDK总览下载安装。
安全声明
- 请确保上传的图片或文件来源符合相应的法律法规。
- 通过体验调试上传的临时文件有效期为1小时,在24小时后会被系统自动清理删除。
在文档使用中是否遇到以下问题
更多建议
匿名提交