可以用python 下面的示例代码是找图并单击,max_val代表识别率 [Python] 纯文本查看 复制代码import cv2 import pyautogui from PIL import ImageGrab import time import numpy img = ImageGrab.grab() # img.save("screen.png") # 图片和路径请勿使用中文 img_wait = cv2.imread("wait.png", cv2.IMREAD_GRAYSCALE) img_checked = cv2.imread("checked.png", cv2.IMREAD_GRAYSCALE) img_play = cv2.imread("play.png", cv2.IMREAD_GRAYSCALE) tmp = img_wait i = 2 tasks = [img_wait, img_play, img_checked] while True: time.sleep(1) img = ImageGrab.grab() img_screen = cv2.cvtColor(numpy.asarray(img), cv2.COLOR_RGB2BGR) img_screen_gray = cv2.cvtColor(img_screen, cv2.COLOR_BGR2GRAY) res = cv2.matchTemplate(img_screen_gray, tasks[i], cv2.TM_CCOEFF_NORMED) _, max_val, min_loc, max_loc = cv2.minMaxLoc(res) if max_val > 0.95: # 找到 i = i + 1 i = i % 3 print(max_loc) pyautogui.moveTo(max_loc) pyautogui.click() 下面的代码是连点器的例子,按下w开始按下q结束 [Python] 纯文本查看 复制代码import win32api, time, win32con, keyboard def keepClick(): time.sleep(1) while True: try: win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0) time.sleep(0.05) except WindowsError as e: print(e) keyboard.add_hotkey('w', keepClick) keyboard.record('q', keepClick)
ibilibili 发表于 2023-1-6 16:14 可以用python 下面的示例代码是找图并单击,max_val代表识别率 [mw_shl_code=python,true]import cv2 这个有点难度,没有接触过Python
小脚本详细介绍在这里: https://www.52pojie.cn/forum.php ... =%D0%A1%BD%C5%B1%BE 最新版下载地址: https://wwvx.lanzoul.com/i1Amw0eild2j