#方法一,可以直接用 import pyautogui,time class Pic(): def __init__(self): pass self.w,self.h = pyautogui.size() def get_win(self,number_x=32,number_y=24): #读取页面,记录rgb数据 tx = int(self.w/number_x) ty = int(self.h/number_y) img = pyautogui.screenshot() with open("remake.csv", "w", encoding="utf-8") as f: for x in range(number_x-1): for y in range(number_y-1): lx = (x + 1) * tx ly = (y + 1) * ty r,g,b = img.getpixel((lx,ly)) f.write("{},{},{},{},{},\n".format(lx,ly,r,g,b)) f.flush() def _read_win(self,lis): #传入坐标,rpg数据判断当前页面是否匹配 count = len(lis) start_time = time.time() while self.reading: count_get = 0 print("正在匹配 = ing&#
python图片匹配
于 2022-05-24 16:35:27 首次发布
本文介绍了如何使用Python进行图片匹配操作。首先,需要运行‘记录当前页面’的代码,完成后再注释掉,接着运行‘识别当前页面’的代码来实现图片的识别功能。
摘要由CSDN通过智能技术生成