OpenCV找图
调用说明
- 请求参数
参数 | 类型 | 说明 | 备注 |
---|---|---|---|
fun | 字符串 | /pic/find-image-cv | 请求功能名 |
id | 字符串 | 设备id | 不允许多个 |
target_img | 字符串 | 目标大图 | 一般不用填写,默认使用我们内部的屏幕图像就行了 |
same | 布尔值 | 是否查找相同的图 | 如果为true则会将图像里所有同样的图都找出来 |
all | 布尔值 | 是否全部找完 | false只从被找图列表找到其中1张就返回,true将会把列表里的图全部找完 |
img_list | 字符串数组 | 被找小图 | base64字符串图片列表或者本地路径列表 |
rect | 整数数组 | 查找区域 | 左x,上y,右x,下y |
similarity | 浮点数 | 相似度 | 大于0小于1 |
- httpGet请求示例
curl --request GET \
--url 'http://192.168.9.9:9911/api/pic/find-image-cv?id=6C:8D:C1:67:04:29&similarity=0.8&img_list=%5B%22D%3A%5C%5CiMouseXP%5C%5CScreenshot%5C%5C1.bmp%22%5D'
- httpPost请求示例
curl --request POST \
--url http://192.168.9.9:9911/api \
--header "content-type: multipart/form-data" \
--form "fun=/pic/find-image-cv" \
--form "id=6C:8D:C1:67:04:29" \
--form "similarity=0.8" \
--form "img_list=[\"D:\\\iMouseXP\\\Screenshot\\\1.bmp\"]"
- httpPost json请求示例【websocket也可发送同样json请求】
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/pic/find-image-cv",
"data": {
"id": "6C:8D:C1:67:04:29",
"img_list": ["D:\\iMouseXP\\Screenshot\\1.bmp"],
"similarity": 0.85
}
}'
响应结果
{
"data": {
"code": 0,
"id": "6C:8D:C1:67:04:29",
"list": [
{
"index": 0,
"centre": [
457,
1231
],
"rect": [
425,
1206,
489,
1257
],
"code": 0
}
],
"message": "成功"
},
"status": 200,
"message": "成功",
"msgid": 0,
"fun": "/pic/find-image-cv"
}
- 响应data数据字段说明
list返回了所有找到的文字列表
字段 | 说明 | 备注 |
---|---|---|
index | 索引 | 找到的是第一幅图,从0开始 |
centre | 找到图像的中心点 | x和y |
rect | 找到图像的矩形区域 | 左x,上y,右x,下y |