airtest.aircv.utils module

print_run_time(func)[source]
generate_result(middle_point, pypts, confi)[source]

Format the result: 定义图像识别结果格式.

check_image_valid(im_source, im_search)[source]

Check if the input images valid or not.

检查图像识别的输入.

img_mat_rgb_2_gray(img_mat)[source]

Turn img_mat into gray_scale, so that template match can figure the img data. “print(type(im_search[0][0])”) can check the pixel type.

img_2_string(img)[source]
string_2_img(pngstr)[source]
pil_2_cv2(pil_image)[source]
cv2_2_pil(cv2_image)[source]
compress_image(pil_img, path, quality, max_size=None)[source]

Save the picture and compress

Parameters:
  • pil_img – PIL image

  • path – save path

  • quality – the image quality, integer in range [1, 99]

  • max_size – the maximum size of the picture, e.g 1200

Returns: