i was wondering how you would use opencv (cv2) in python for making an alternative to pyautogui.locatecenteronscreen() function, just useing an image instead of an screen. i will try useing an example.
maybe an user defined function,locateCenterOfTemplate("Path/to/template.png") and now since im useing a screenshot as original image, it will ofc be the same as if i would use pyautoguis, but for my main purpose i wont ofc.
import cv2
import pyautogui
pyautogui.screenshot(Path/to/original_image.png)
def locateCenterOfTemplate(image, template, accuracy=100,
region=#whole screen idk how to do this eaither):
temp = locateCenterOfTemplate("Path/to/original_image.png", "Path/to/template.png")
# now variable "temp" is the same as the posision of the center of the template,
# inside of the source immage
pyautogui.click(temp)
Basicly, i would like to have template matching with reagion, confidence and both template and original image as a functino :)
Thanks :D