查找文字
调用说明
还有一个功能名 /pic/find-text-ex 使用的增强版ocr识别更精准,但占资源
- 请求参数
参数 | 类型 | 说明 | 备注 |
---|---|---|---|
fun | 字符串 | /pic/find-text | 请求功能名 |
id | 字符串 | 设备id | 不允许多个 |
target_img | 字符串 | 目标大图 | 一般不用填写,默认使用我们内部的屏幕图像就行了 |
rect | 整数数组 | 查找区域 | 左x,上y,右x,下y |
similarity | 浮点数 | 相似度 | 最好先用ocr识别一次看看相似度能有多少 |
contain | 布尔值 | 是否包含 | |
text | 字符串数组 | 需要查找的文字数组 |
- httpGet请求示例
curl --request GET \
--url 'http://192.168.9.9:9911/api/pic/find-text?id=6C:8D:C1:67:04:29&contain=true&similarity=0.8&text=%5B%22D2B6%22%2C%22DCA1%22%5D'
- httpPost请求示例
curl --request POST \
--url http://192.168.9.9:9911/api \
--header "content-type: multipart/form-data" \
--form "fun=/pic/find-text" \
--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/find-text",
"data": {
"id": "6C:8D:C1:67:04:29"
}
}'
响应结果
{
"data": {
"code": 0,
"id": "6C:8D:C1:67:04:29",
"list": [
{
"text": "iMouseXP-D2B6",
"centre": [
283,
581
],
"rect": [
153,
565,
413,
598
],
"similarity": 0.98
},
{
"text": "iMouseXP-DCA1",
"centre": [
281,
685
],
"rect": [
153,
671,
409,
700
],
"similarity": 0.91
}
],
"message": "成功"
},
"status": 200,
"message": "成功",
"msgid": 0,
"fun": "/pic/find-text"
}
- 响应data数据字段说明
list返回了所有找到的文字列表
字段 | 说明 | 备注 |
---|---|---|
text | 识别到的文字 | |
centre | 文字的中心点 | x和y |
rect | 文字的矩形区域 | 左x,上y,右x,下y |
similarity | 相似度 |