Python 用于在图像中查找图案的库
Python library for looking patterns in an image
我正在寻找一个 python 库,它可以搜索图像并找到我提供的较小图像文件的坐标,例如 https://pyautogui.readthedocs.org/en/latest/screenshot.html#the-locate-functions. For example if i had http://i.stack.imgur.com/hWfBm.png 中的那个
我想找到所有有野草的地方,图书馆可以帮助我吗?
安装 OpenCV 库和 link 到系统路径中的 Python 绑定。如果您不知道如何执行此操作,请尝试在 Youtube 上获取适用于您的操作系统的说明。从那里,保存包含一个草方块的图像。
import cv2
import numpy as np
world = cv2.imread("world.png") # entire world image
grass = cv2.imread("grass.png") # grass image
result = cv2.matchTemplate(world, grass, cv2.TM_CCOEFF_NORMED)
print np.unravel_index(result.argmax(), result.shape)
我正在寻找一个 python 库,它可以搜索图像并找到我提供的较小图像文件的坐标,例如 https://pyautogui.readthedocs.org/en/latest/screenshot.html#the-locate-functions. For example if i had http://i.stack.imgur.com/hWfBm.png 中的那个 我想找到所有有野草的地方,图书馆可以帮助我吗?
安装 OpenCV 库和 link 到系统路径中的 Python 绑定。如果您不知道如何执行此操作,请尝试在 Youtube 上获取适用于您的操作系统的说明。从那里,保存包含一个草方块的图像。
import cv2
import numpy as np
world = cv2.imread("world.png") # entire world image
grass = cv2.imread("grass.png") # grass image
result = cv2.matchTemplate(world, grass, cv2.TM_CCOEFF_NORMED)
print np.unravel_index(result.argmax(), result.shape)