Пример #1
0
 def screenshot_mutlfind(self, template_img_path):
     """
     截取游戏画面并查找图片位置
     :param template_img_path: 差早图片位置
     :return: 成功返回图片位置[left_top,right_bottom],失败返回None
     """
     screenshot = self.window.hwd_screenshot()
     screenshot_height, screenshot_width = screenshot.shape[:2]
     template_img = Image.read_img(template_img_path, 0)
     zoom = screenshot_width / default_window_width  # 计算缩放比例
     return self.search_mutlimg_zoom(template_img, screenshot, zoom)
Пример #2
0
 def find_imgs(self, template_img_paths):
     """
     检查当前场景是否存在其中一个图片
     :param template_img_paths:要查找的图片位置
     :return: 成功返回True,失败返回False
     """
     screenshot = self.screenshot()
     screenshot_height, screenshot_width = screenshot.shape[:2]
     zoom = screenshot_width / default_window_width  # 计算缩放比例
     for i in range(0, len(template_img_paths)):
         template_img = Image.read_img(template_img_paths[i], 0)
         pos = self.find_img_zoom(template_img, screenshot, zoom)
         if pos is not None:
             return [i, pos, template_img_paths[i]]
     return None