多点找色
调用说明
- 请求参数
参数 | 类型 | 说明 | 备注 |
---|---|---|---|
fun | 字符串 | /pic/find-multi-color | 请求功能名 |
id | 字符串 | 设备id | 不允许多个 |
target_img | 字符串 | 目标大图 | 一般不用填写,默认使用我们内部的屏幕图像就行了 |
same | 布尔值 | 是否查找相同的图 | 如果为true则会将图像里所有同样的颜色表都找出来 |
all | 布尔值 | 是否全部找完 | false只从被找色列表找到其中1条就返回,true将会把列表里的色全部找完 |
list | json对象数组 | - | - |
list内json对象数组参数说明:
参数 | 类型 | 说明 | 备注 |
---|---|---|---|
first_color | 字符串 | 被查找的颜色表 | - |
rect | 整数数组 | 查找区域 | 左x,上y,右x,下y 为空全屏查找 |
similarity | 浮点数 | 相似度 | - |
- httpGet请求示例
curl --request GET \
--url 'http://192.168.9.9:9911/api/pic/find-multi-color?id=6C:8D:C1:67:04:29&list=%5B%7B%22first_color%22%3A%20%22284%7C1224%7C2AB9F3-000000%2C310%7C1235%7C29ADF1-000000%2C281%7C1225%7C29B8F2-000000%2C288%7C1236%7CEB2A31-000000%2C286%7C1258%7C2693EC-000000%2C262%7C1253%7C2699EE-000000%2C265%7C1228%7C2AB5F2-000000%2C305%7C1232%7CC25B78-000000%2C336%7C1253%7C2997EE-000000%2C301%7C1258%7C2693EC-000000%2C281%7C1245%7CFFFFFC-000000%22%2C%22similarity%22%3A%200.85%7D%5D'
- httpPost请求示例
curl --request POST \
--url http://192.168.9.9:9911/api \
--header "Content-Type: multipart/form-data" \
--form "fun=/pic/find-multi-color" \
--form "id=6C:8D:C1:67:04:29" \
--form "list=[{\"first_color\":\"284|1224|2AB9F3-000000,310|1235|29ADF1-000000,281|1225|29B8F2-000000,288|1236|EB2A31-000000,286|1258|2693EC-000000,262|1253|2699EE-000000,265|1228|2AB5F2-000000,305|1232|C25B78-000000,336|1253|2997EE-000000,301|1258|2693EC-000000,281|1245|FFFFFC-000000\",\"similarity\":0.85}]"
- httpPost json请求示例【websocket也可发送同样json请求】
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/pic/find-multi-color",
"data": {
"id": "60:9A:C1:9A:22:A1",
"list": [
{
"first_color": "284|1224|2AB9F3-000000,310|1235|29ADF1-000000,281|1225|29B8F2-000000,288|1236|EB2A31-000000,286|1258|2693EC-000000,262|1253|2699EE-000000,265|1228|2AB5F2-000000,305|1232|C25B78-000000,336|1253|2997EE-000000,301|1258|2693EC-000000,281|1245|FFFFFC-000000",
"similarity": 0.85
}
],
"same": false,
"all": false
}
}'
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/pic/find-multi-color",
"data": {
"id": "6C:8D:C1:67:04:29",
"list": [
{
"rect": [
0,
0,
0,
0
],
"first_color": "284|1224|2AB9F3-000000,310|1235|29ADF1-000000,281|1225|29B8F2-000000,288|1236|EB2A31-000000,286|1258|2693EC-000000,262|1253|2699EE-000000,265|1228|2AB5F2-000000,305|1232|C25B78-000000,336|1253|2997EE-000000,301|1258|2693EC-000000,281|1245|FFFFFC-000000",
"similarity": 0.85
}
],
"same": false,
"all": false
}
}'
响应结果
{
"data": {
"code": 0,
"id": "60:9A:C1:9A:22:A1",
"list": [
{
"index": 0,
"centre": [
286,
1222
]
}
],
"message": "成功"
},
"status": 200,
"message": "成功",
"msgid": 0,
"fun": "/pic/find-multi-color"
}
- 响应data数据字段说明
list返回了所有找到的文字列表
字段 | 说明 | 备注 |
---|---|---|
index | 索引 | 找到的是第1个找色配置,从0开始 |
centre | 找到图像的中心点 | x和y |