我正试图在我的图像上找到一个特定的符号。例如,以这个为例:屏幕截图,我如何定位心脏符号的位置(比如按钮)?以像素为单位的位置,其中坐标系的原点位于左下角。我想通过使用python来实现di。非常感谢!
PS:类似的符号可以改变任何截图的位置。
发布于 2020-05-19 13:58:57
如果它是一个简单的恒定大小和定义良好的图像,就像它看上去的那样,您可以使用模板匹配。
在python中有一个很好的模块。
简单地说:
from skimage.io import imread
from skimage.feature import match_template
from skimage.color import rgb2gray
image = imread('big_image.jpg')
template = imread('template.jpg')
image_gray = rgb2gray(image)
template_gray = rgb2gray(template)
result = match_template(image_gray, template_gray)
ij = np.unravel_index(np.argmax(result), result.shape)
x, y = ij[::-1]https://stackoverflow.com/questions/61890630
复制相似问题