airtest.core.cv module
“Airtest图像识别专用.
- loop_find(query, timeout=20, threshold=None, interval=0.5, intervalfunc=None)[source]
Search for image template in the screen until timeout
- Parameters:
query – image template to be found in screenshot
timeout – time interval how long to look for the image template
threshold – default is None
interval – sleep interval before next attempt to find the image template
intervalfunc – function that is executed after unsuccessful attempt to find the image template
- Raises:
TargetNotFoundError – when image template is not found in screenshot
- Returns:
TargetNotFoundError if image template not found, otherwise returns the position where the image template has been found in screenshot
- try_log_screen(screen=None, quality=None, max_size=None)[source]
Save screenshot to file
- Parameters:
screen – screenshot to be saved
quality – The image quality, default is ST.SNAPSHOT_QUALITY
max_size – the maximum size of the picture, e.g 1200
- Returns:
filename, “resolution”: aircv.get_resolution(screen)}
- Return type:
{“screen”
- class Template(filename, threshold=None, target_pos=5, record_pos=None, resolution=(), rgb=False, scale_max=800, scale_step=0.005)[source]
Bases:
object
picture as touch/swipe/wait/exists target and extra info for cv match filename: pic filename target_pos: ret which pos in the pic record_pos: pos in screen when recording resolution: screen resolution when recording rgb: 识别结果是否使用rgb三通道进行校验. scale_max: 多尺度模板匹配最大范围. scale_step: 多尺度模板匹配搜索步长.
- property filepath