question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

locateOnScreen not matching

See original GitHub issue

locateOnScreen is not matching, also tried the confidence parameters that is mentioned in other issues like this one but is not working, also didn’t found that parameter in screenshotUtil.py file for this method.

These images are not matching for me, (just tested on windows): h2 heart

any ideas what could be causing this problem? also tried with grayscale

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mogameprocommented, May 31, 2018

Do you have openCV installed? If it is, pyautogui uses pyscreeze._locateAll_opencv and if openCV isn’t installed it uses pyscreeze._locateAll_python. I just tried both and the openCV one found the smaller image in the bigger one and the python one didn’t. I’m not knowledgeable enough about the inner workings to understand why it didn’t match it though. If you don’t have openCV installed, I’d suggest installing it and trying again. If you do have it installed, then I’m not sure why it works for me and not for you.

.locateAll_opencv is the only one of the two that uses the confidence parameter and you have to look in pyscreeze to find it.

0reactions
aabustamantecommented, Jun 2, 2018

@mogamepro, thank you for your help. that worked. I will close this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why PyAutoGui LocateOnScreen() only Returns None
The locateOnScreen() function returns None if the image wasn't found on the screen. Remember, the match has to be pixel-perfect in order to ......
Read more >
Screenshot Functions - PyAutoGUI documentation
locateOnScreen (image, grayscale=False) - Returns (left, top, width, height) coordinate of first found instance of the image on the screen. Raises ...
Read more >
Python 3.6.3 pyautogui.locateOnScreen not working
locateOnScreen not working. ... Matching, filtering and grouping in list comprehension ... locateOnScreen is returning None, even after 20 screenshots!
Read more >
PyAutoGUI - Locate anything on your screen - YouTube
This is the second tutorial video on PyAutoGUI. In this tutorial I will teach you to locate anything on your screen using ...
Read more >
Nearest match for images? : r/learnpython
locateOnScreen('image.png') that returns coordinates of exact match ... You could do an if not found, check confidence recursively lower.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found