返回值為json格式,各字段如下:
|參數|類型|說明|
|:------|:-----|:-----|
|code|string|結果碼(具體見錯誤碼)|
|data|json|詳見data說明|
|desc|string|描述|
|sid|string|會話ID|
sid字段用于追查問題,出現問題時可提供sid給訊飛技術人員幫助排查。
data各字段說明如下:
|參數|類型|說明|
|:------|:-----|:-----|
|block|對象數組|區域塊信息|
|type|string|區域塊類型(text-文本,image-圖片)|
|line|對象數組|行信息|
|word|對象數組|字(中文),單詞(英文)|
|content|string|內容|
|confidence|float|后驗概率|
|location|對象|位置信息|
|top_left|對象|左上角位置信息|
|right_bottom|對象|右下角位置信息|
|x|int|對應點的橫坐標(像素)|
|y|int|對應點的縱坐標(像素)|
失敗:
{
"code": "10106",
"desc": "invalid parameter|invalid X-Appid",
"data": "",
"sid": "wcr0000bb3f@ch3d5c059d83b3477200"
}
成功
> 含位置信息
{
"code": "0",
"desc": "success",
"data": {
"block": [
{
"location": {
"top_left": {
"x": 0,
"y": 0
},
"right_bottom": {
"x": 10,
"y": 10
}
},
"type": "text",
"line": [
{
"confidence": 0.89,
"location": {
"top_left": {
"x": 0,
"y": 0
},
"right_bottom": {
"x": 10,
"y": 10
}
},
"word": [
{
"location": {
"top_left": {
"x": 0,
"y": 0
},
"right_bottom": {
"x": 10,
"y": 10
}
},
"content": "hello"
}
]
}
]
}
]
},
"sid": "wcr0000bb3f@ch3d5c059d83b3477200"
}
> 不含位置信息
{
"code": "0",
"desc": "success",
"data": {
"block": [
{
"type": "text",
"line": [
{
"confidence": 0.89,
"word": [
{
"content": "hello"
}
]
}
]
}
]
},
"sid": "wcr0000bb3f@ch3d5c059d83b3477200"
}