在全屏或指定区域范围内寻找指定图片的坐标,支持相似查找。如找到目标图,则返回找到位置的左上角坐标。该函数有 6 种重载方法,对应不同的参数。
对应JS API:
Device.seekImage(imageName)
Device.seekImage(imageName, sim)
Device.seekImage(topLeftX, topLeftY, bottomRightX, bottomRightY, imageName)
Device.seekImage(topLeftX, topLeftY, bottomRightX, bottomRightY, imageName, sim)
Device.seekImage(topLeftX, topLeftY, bottomRightX, bottomRightY, imageName, sim, beGray)
Device.seekImage(imageName, sim, beGray)
是否支持多设备:
不支持
请求方式:
GET
http://IP:8090/TotalControl/v1/devices/:device/screen/images
参数:
参数名 | 类型 | 必选 | 描述 |
---|---|---|---|
token | string | Y | Total Control TOKEN |
:device | string | Y | 主控设备对象值 id |
name | string | Y | 需要对比图片路径 |
sim | float | N | 相似度,取值范围为[0.0, 1.0] |
rect | string | N | 格式:[topLeftX,topLeftY,bottomRightX,bottomRightY] 指定截屏区域,具体说明如下: topLeftX: 屏幕上指定范围左上角 X 坐标 topLeftY: 屏幕上指定范围左上角 Y 坐标 bottomRightX: 屏幕上指定范围右下角 X 坐标 bottomRightY: 屏幕上指定范围右下角 Y 坐标 |
same | string | N | 当此值为true时,表示要寻找的小图和大图取自同一台手机,因此在找图时无需缩放,也无需进行相似查找。对于在同一台手机上的找图行为,这两个函数更加快速准确。Device.seekImage(imageName, sim, same) TC 6.8.0 之前可以使用 |
beGray | string | N | 当此值为true时(默认为true),表示图片要先进行灰度处理,然后再进行找图。当此值为false时候,表示图片不进行任何处理就进行找图,当然灰度处理后找图速度更快。从 TC 6.8.0 开始可以使用。 |
请求示例:
示列1:
http://localhost:8090/TotalControl/v1/devices/device@1116106541/screen/images?token=270eq7lXQK8bXYsJ&name=C:/Users/S/Desktop/360.bmp
示列2:
http://localhost:8090/TotalControl/v1/devices/device@1116106541/screen/images?token=270eq7lXQK8bXYsJ&name=C:/Users/S/Desktop/360.bmp&sim=0.1
示列3:
http://localhost:8090/TotalControl/v1/devices/device@1116106541/screen/images?token=270eq7lXQK8bXYsJ&name=C:/Users/S/Desktop/360.bmp&rect=[0,0,600,600]
示列4:
http://localhost:8090/TotalControl/v1/devices/device@1116106541/screen/images?token=270eq7lXQK8bXYsJ&name=C:/Users/S/Desktop/360.bmp&rect=[0,0,600,600]&sim=0.5
示列5:
http://localhost:8090/TotalControl/v1/devices/device@1116106541/screen/images?token=270eq7lXQK8bXYsJ&name=C:/Users/S/Desktop/360.bmp&rect=[0,0,600,600]&same=true&sim=0.5
示列6:
http://localhost:8090/TotalControl/v1/devices/device@1116106541/screen/images?token=270eq7lXQK8bXYsJ&name=C:/Users/S/Desktop/360.bmp&same=true&sim=0.5
返回示例:
{
"status": true,
"value":[272,371]
}
返回字段说明:
字段 | 类型 | 描述 |
---|---|---|
status | boolean | true:成功; false:失败 |
value | string | 成功找到图片的坐标 |