AirtestProject / AirtestProject/Airtest

AirtestIDE 1.2.2中使用本地环境(airtest1.1.0),rgb识别貌似失灵了。

未关闭
#569 0 条评论 0 个 reaction 已指派 1 人 已被 @rockywhisper 认领 在 GitHub 查看
bug
主要语言
Python
星标
9.6k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

**描述问题bug**
我遇到了一个场景,应用中可以切换debug环境和正式环境,不同环境顶部用户中心界面的背景颜色会不同,debug环境为蓝色,正式环境为红色。
于是我使用了rgb识别,threshold 0.95,图片识别语句如下:
`exists(Template(r"tpl1571663529674.png", threshold=0.95, rgb=True, record_pos=(-0.003, -0.747), resolution=(1080, 1920)))`
返回结果竟然命中了,甚至我把threshold设为1,也命中了。log如下:
```
`[09:43:24][DEBUG] try match with SURFMatching
[09:43:24][DEBUG] [SURF] threshold=0.95, result={'result': (446, 152), 'rectangle': [(303, 101), (303, 204), (590, 204), (590, 101)], 'confidence': 0.9177039604187012}
[09:43:24][DEBUG] find_best_result() run time is 0.58 s.
[09:43:24][DEBUG] try match with TemplateMatching
[09:43:24][DEBUG] [Template] threshold=0.95, result={'result': (447, 153), 'rectangle': ((303, 102), (303, 205), (591, 205), (591, 102)), 'confidence': 0.9207895016074179}
[09:43:24][DEBUG] find_best_result() run time is 0.11 s.
[09:43:24][DEBUG] try match with BRISKMatching
[09:43:25][DEBUG] [BRISK] threshold=0.95, result={'result': (447, 153), 'rectangle': [(304, 102), (304, 204), (591, 204), (591, 102)], 'confidence': 0.959229315072298}
[09:43:25][DEBUG] find_best_result() run time is 0.34 s.
[09:43:25][DEBUG] match result: {'result': (447, 153), 'rectangle': [(304, 102), (304, 204), (591, 204), (591, 102)], 'confidence': 0.959229315072298}`
```

**相关截图**
应用场景:
![image](https://user-images.githubusercontent.com/13826076/67254980-707b5e00-f4b2-11e9-9ee9-aea67daa717a.png)

代码:
![image](https://user-images.githubusercontent.com/13826076/67254696-0d3cfc00-f4b1-11e9-9943-e69d5b2892b2.png)

代码(转文字):
![image](https://user-images.githubusercontent.com/13826076/67254725-2f367e80-f4b1-11e9-8581-3a89faf3e94a.png)

匹配结果:
![image](https://user-images.githubusercontent.com/13826076/67254735-41b0b800-f4b1-11e9-9af7-8b2bbd6327ff.png)

命中测试截图:
![image](https://user-images.githubusercontent.com/13826076/67254751-5a20d280-f4b1-11e9-98d9-9a17fdd22926.png)
![image](https://user-images.githubusercontent.com/13826076/67254774-7a509180-f4b1-11e9-8663-fef6b68d8e6b.png)

**预期效果**
正常来说,如果开启rgb识别,就算识别度再低,阈值设置到了0.95(甚至是1),也不至于匹配吧。

**python 版本:** `python3.6`

**airtest 版本:** `1.1.0`
> airtest版本通过`pip freeze`可以命令可以查到

**设备:**
mumu模拟器,Android6.0.1,mi6

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。