How to use _target_error_check method in Airtest

Best Python code snippet using Airtest Github


Full Screen

...33 # 匹配点对 >= 4个,使用单矩阵映射求出目标区域,据此算出可信度:34 middle_point, pypts, w_h_range = _many_good_pts(im_source, im_search, kp_sch, kp_src, good)35 # 第四步:根据识别区域,求出结果可信度,并将结果进行返回:36 # 对识别结果进行合理性校验: 小于5个像素的,或者缩放超过5倍的,一律视为不合法直接raise.37 _target_error_check(w_h_range)38 # 将截图和识别结果缩放到大小一致,准备计算可信度39 x_min, x_max, y_min, y_max, w, h = w_h_range40 target_img = im_source[y_min:y_max, x_min:x_max]41 resize_img = cv2.resize(target_img, (w, h))42 confidence = _cal_sift_confidence(im_search, resize_img, rgb=rgb)43 best_match = generate_result(middle_point, pypts, confidence)44 print("[aircv][sift] threshold=%s, result=%s" % (threshold, best_match))45 return best_match if confidence >= threshold else None46def _get_key_points(im_source, im_search, good_ratio):47 """根据传入图像,计算图像所有的特征点,并得到匹配特征点对."""48 # 准备工作: 初始化sift算子49 sift = _init_sift()50 # 第一步:获取特征点集,并匹配出特征点对: 返回值 good, pypts, kp_sch, kp_src51 kp_sch, des_sch = sift.detectAndCompute(im_search, None)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?