detectDeviceSnap(设备抓图检测)
detectDeviceSnap:设备抓图检测
功能详情
对已绑定到开发者账号的指定设备通道发起一次抓图,并对抓到的画面做云端 AI 检测。适用于需要直接使用设备画面、而不自行上传图片 URL 或 Base64 的场景。
本接口支持人、车、动物、包裹的目标检测。
设备须在线且已绑定;抓图频率与 setDeviceSnapEnhanced:设备抓图增强 等设备能力限制一致,请勿高频调用。
请求地址
POST https://openapi-[DataCenter].easy4ip.com/openapi/detectDeviceSnap
最小权限
管理员 accessToken;设备须属于该开发者账号。
传入参数
| 参数名 | 参数类型 | 是否必填 | 参数说明 |
|---|---|---|---|
| token | String | 是 | 管理员 accessToken |
| deviceId | String | 是 | 设备序列号 |
| channelId | String | 是 | 通道 ID |
样例输入
{
"id": "98a7a257-c4e4-4db3-a2d3-d97a3836b87c",
"system": {
"ver": "1.0",
"appId": "lcdxxxxxxxxx",
"sign": "b7e5bbcc6cc07941725d9ad318883d8e",
"time": 1599013514,
"nonce": "fbf19fc6-17a1-4f73-a967-75eadbc805a2"
},
"params": {
"token": "At_12345678901234567890123456789012",
"deviceId": "TESTQWERXXXX",
"channelId": "0"
}
}
返回 data 字段说明
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
| url | String | 图片地址 |
| detectResult | Boolean | 是否检测到目标 |
| targets | Array | 检测目标 |
| targets[].targetRegion | Object | 目标区域,单位 px |
| targets[].targetRegion.x | Double | 横坐标 |
| targets[].targetRegion.width | Double | 宽度 |
| targets[].targetRegion.height | Double | 高度 |
| targets[].targetType | String | 目标类型:human、vehicle、animal、box |
| targets[].confidence | Integer | 置信度 |
样例输出
{
"result": {
"msg": "操作成功.",
"code": "0",
"data": {
"url": "https://example.com/snap/sample.jpg",
"detectResult": true,
"targets": [
{
"targetRegion": {
"x": 120.0,
"width": 64.0,
"height": 96.0
},
"targetType": "human",
"confidence": 85
}
]
}
},
"id": "98a7a257-c4e4-4db3-a2d3-d97a3836b87c"
}
错误码
设备离线、未绑定或抓图失败时可能返回设备类业务码(如 DV 段);其余见 错误码。
