Python 屏幕阅读并与图像比较
Python Screen reading and compare with image
嘿,我是 python 的新手,但我正在寻找一种可能性,将我的 运行 应用程序与图像进行比较,并检查该图像是否显示在 运行 中应用。如果是,我想获得匹配位置的坐标。这可能吗?
我认为它与 PIL 和 imagegrab 或其他东西有关,但我不确定这是否会按预期工作。
考虑使用 PIL
和 openCV
完成这项工作。
from PIL import ImageGrab
pil_img = ImageGrab.grab()
opencv_img = numpy.array(pil_img)
然后用OpenCV对图像进行处理,找到你要找的子图像。查看这些可以满足您的需求,甚至可以旋转、缩放图像等。
http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html
如果你想做这个跨平台,那么你将需要使用wxWidgets来做screengrab,见this
嘿,我是 python 的新手,但我正在寻找一种可能性,将我的 运行 应用程序与图像进行比较,并检查该图像是否显示在 运行 中应用。如果是,我想获得匹配位置的坐标。这可能吗?
我认为它与 PIL 和 imagegrab 或其他东西有关,但我不确定这是否会按预期工作。
考虑使用 PIL
和 openCV
完成这项工作。
from PIL import ImageGrab
pil_img = ImageGrab.grab()
opencv_img = numpy.array(pil_img)
然后用OpenCV对图像进行处理,找到你要找的子图像。查看这些可以满足您的需求,甚至可以旋转、缩放图像等。
http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html
如果你想做这个跨平台,那么你将需要使用wxWidgets来做screengrab,见this