为什么我要检测定义区域之外的图像?
Why am I detecting image outside of a defined region?
我用pyautogui.displayMousePosition()
确定我要搜索的地方左上角是750, 25右下角是1200, 125
为什么此代码在 1649、99
找到正匹配
for image in image_list:
name = image
location = pyautogui.locateCenterOnScreen(image, region=(750, 25, 1200, 125), confidence=0.9, grayscale=True)
print(name + " Found at: " + str(location))
根据 documention 看起来是正确的。
在文档中,区域被定义为一个框,因此前两个参数是左上角的 x,y 坐标,接下来的两个参数是宽度和高度。
试试 (750,25,1200-750,125-25)
我用pyautogui.displayMousePosition()
确定我要搜索的地方左上角是750, 25右下角是1200, 125
为什么此代码在 1649、99
找到正匹配 for image in image_list:
name = image
location = pyautogui.locateCenterOnScreen(image, region=(750, 25, 1200, 125), confidence=0.9, grayscale=True)
print(name + " Found at: " + str(location))
根据 documention 看起来是正确的。
在文档中,区域被定义为一个框,因此前两个参数是左上角的 x,y 坐标,接下来的两个参数是宽度和高度。
试试 (750,25,1200-750,125-25)