OCR文字识别
调用说明
还有一个功能名 /pic/ocr 增强版ocr识别更精准,但占资源
- 请求参数
参数 | 类型 | 说明 | 备注 |
---|---|---|---|
fun | 字符串 | /pic/ocr | 请求功能名 |
id | 字符串 | 设备id | 不允许多个 |
target_img | 字符串 | 目标大图 | 一般不用填写,默认使用我们内部的屏幕图像就行了 |
rect | 整数数组 | 查找区域 | 左x,上y,右x,下y |
- httpGet请求示例
curl --request GET \
--url 'http://192.168.9.9:9911/api/pic/ocr?id=6C:8D:C1:67:04:29'
- httpPost请求示例
curl --request POST \
--url http://192.168.9.9:9911/api \
--header "content-type: multipart/form-data" \
--form "fun=/pic/ocr" \
--form "id=6C:8D:C1:67:04:29"
- httpPost json请求示例【websocket也可发送同样json请求】
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/pic/ocr",
"data": {
"id": "6C:8D:C1:67:04:29"
}
}'
响应结果
{
"data": {
"code": 0,
"id": "6C:8D:C1:67:04:29",
"list": [
{
"text": "幕镜像输出",
"centre": [
374,
475
],
"rect": [
270,
457,
478,
494
],
"similarity": 0.82
}
],
"message": "成功"
},
"status": 200,
"message": "成功",
"msgid": 0,
"fun": "/pic/ocr"
}
- 响应data数据字段说明
list返回了所有找到的文字列表
字段 | 说明 | 备注 |
---|---|---|
text | 识别到的文字 | |
centre | 文字的中心点 | x和y |
rect | 文字的矩形区域 | 左x,上y,右x,下y |
similarity | 相似度 |