指尖文字识别 API
POST
http[s]: //tyocr.xfyun.cn/v2/ocr请求参数
Body 参数application/json
common
object
用于上传公共参数
app_id
string
必需
在平台申请的appid信息
business
object
用于上传业务参数
ent
string
必需
请求引擎类型,只支持fingerocr
mode
string
可选
模式,选择范围:finger,finger+ocr(默认值)。 finger模式:只进行手指检测,返回手指位置、方向、宽度等信息 finger+ocr模式:进行手指检测以及OCR识别,返回手指指向的字、词、句信息
method
string
可选
方法,取值:dynamic(默认值)。根据指尖位置裁剪感兴趣区域(ROI)进行OCR识别
resize_w
integer
可选
引擎内部处理模块输入图像宽度,取值范围:[1,65536]。 若应用端上传图像宽为input_w,scale为缩放系数,则resize_w=input_w*scale。 若不缩放直接按原图处理,引擎耗时会变长,建议根据实际情况测试以寻求最佳值
resize_h
integer
可选
引擎内部处理模块输入图像高度,取值范围:[1,65536]。 若应用端上传图像高为input_h,scale为缩放系数,则resize_h=input_h*scale。 若不缩放直接按原图处理,引擎耗时会变长,建议根据实际情况测试以寻求最佳值
data
object
必需
用于上传识别图像数据
image
string
必需
图像数据,base64编码 大小不超过4M,支持jpg/png/bmp格式 另外,图片分辨率500W像素以上,或者500W像素图片中的部分裁剪区域,图片中文字高度最好大于24像素,且包含不少于两个指节以上的手部区域,否则会影响识别效果
示例
{
"common": {
"app_id": "xxxxxxxx"
},
"business": {
"ent": "fingerocr",
"mode": "finger+ocr",
"method": "dynamic",
"resize_w": 1080,
"resize_h": 1080
},
"data": {
"image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2..."
}
}
示例代码
返回响应
成功(mode=finger+ocr)(200)
成功(mode=finger)(200)
成功(mode=finger+ocr)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
code
integer
必需
data
object
必需
finger_ocr
object
必需
指尖文字识别结果,仅mode=finger+ocr时返回
finger_pos
object
手指信息
height
integer
必需
mode
string
必需
version_engine
string
必需
version_json
string
必需
width
integer
必需
message
string
必需
sid
string
必需
示例
成功示例
{
"code": 0,
"data": {
"finger_ocr": {
"char": {
"id": 4,
"list": [
{
"content": "b",
"coord": [
{
"x": 448,
"y": 665
},
{
"x": 471,
"y": 666
},
{
"x": 470,
"y": 699
},
{
"x": 447,
"y": 698
}
],
"score": 62.64982223510742
},
{
"content": "i",
"coord": [
{
"x": 472,
"y": 666
},
{
"x": 479,
"y": 666
},
{
"x": 478,
"y": 699
},
{
"x": 471,
"y": 699
}
],
"score": 48.28302001953125
},
{
"content": "r",
"coord": [
{
"x": 480,
"y": 666
},
{
"x": 492,
"y": 666
},
{
"x": 491,
"y": 699
},
{
"x": 479,
"y": 699
}
],
"score": 39.7555046081543
},
{
"content": "t",
"coord": [
{
"x": 493,
"y": 666
},
{
"x": 500,
"y": 666
},
{
"x": 499,
"y": 699
},
{
"x": 492,
"y": 699
}
],
"score": 32.40756225585938
},
{
"content": "h",
"coord": [
{
"x": 501,
"y": 666
},
{
"x": 521,
"y": 667
},
{
"x": 520,
"y": 700
},
{
"x": 500,
"y": 699
}
],
"score": 25.59785079956055
},
{
"content": "d",
"coord": [
{
"x": 522,
"y": 667
},
{
"x": 541,
"y": 667
},
{
"x": 540,
"y": 700
},
{
"x": 521,
"y": 700
}
],
"score": 28.72716522216797
},
{
"content": "a",
"coord": [
{
"x": 542,
"y": 667
},
{
"x": 562,
"y": 668
},
{
"x": 561,
"y": 701
},
{
"x": 541,
"y": 700
}
],
"score": 42.85148620605469
},
{
"content": "y",
"coord": [
{
"x": 563,
"y": 668
},
{
"x": 578,
"y": 668
},
{
"x": 577,
"y": 701
},
{
"x": 562,
"y": 701
}
],
"score": 58.89184951782227
},
{
"content": ".",
"coord": [
{
"x": 579,
"y": 668
},
{
"x": 587,
"y": 668
},
{
"x": 586,
"y": 701
},
{
"x": 578,
"y": 701
}
],
"score": 999999
}
]
},
"sent": {
"content": "December 1st It was Mocky's birthday",
"coord": [
{
"x": 448,
"y": 666
},
{
"x": 589,
"y": 669
},
{
"x": 588,
"y": 701
},
{
"x": 447,
"y": 697
}
]
},
"word": {
"id": 0,
"list": [
{
"content": "birthday",
"coord": [
{
"x": 448,
"y": 665
},
{
"x": 578,
"y": 668
},
{
"x": 577,
"y": 701
},
{
"x": 447,
"y": 698
}
],
"score": 60.77083587646484
},
{
"content": ".",
"coord": [
{
"x": 579,
"y": 668
},
{
"x": 587,
"y": 668
},
{
"x": 586,
"y": 701
},
{
"x": 578,
"y": 701
}
],
"score": 999999
}
]
}
},
"finger_pos": {
"angle": -96.33390045166016,
"dir_x": -4,
"dir_y": -36,
"pos_x": 516,
"pos_y": 708,
"thickness": 112.6410217285156
},
"height": 0,
"mode": "finger+ocr",
"version_engine": "V1.0.10",
"version_json": "1.0",
"width": 0
},
"message": "success",
"sid": "ocrXXXXXXXXXXXXXXXXXXXXXXXX"
}
最后修改时间: 1 年前