I am trying to locate a specific symbol on my image. For instance take this as an example: Screenshot , How would I locate the location of the heart symbol (like button)? Location as in pixels, where the origin of the coordinate system is at the bottom left corner. I would like to to di by using python. Thanks a lot!
PS: the like symbol could change location for any screenshot
If it's a simple constant-size and well defined image, as it seems to be, you could use template matching .
In python there's an excellent Scikit Image module .
In brief:
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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.