I use pyautogui to search an image on Desktop window for click automation.

pyautogui.locateOnScreen(image)

If the image is captured on the same screen as screenshot, it can be matched. However, if the image is a bit different, it cannot. e.g. captured as the low resolution image.
Can I set some likelihood in pyautogui or use other library?
Use confidence, default value is 0.999. Reason is pyscreeze is actually used by pyautogui which has the confidence value which most likely represents a percentage from 0% - 100% for a similarity match. Looking through the code with my amateur eyes reveals that OpenCV and NumPy are required for confidence to work otherwise a different function would be used that doesn't have the confidence value.
for example:
pyautogui.locateCenterOnScreen('foo.png', confidence=0.5)
will set your confidence to 0.5, which means 50%.
How to search not same images but similar images by pyautogui