-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imagesearch returns wrong coordinates #8
Comments
Hello, I've tested your code and it runs fine on my end (ubuntu 18, double monitors as well). Since you have a mac I assume that the problem might be related to your high resolution. I have never tested it with resolutions higher than 1920×1080. I've had a guy in the past with a retina display that had errors and here's his comment : "However I had troubles with retina display and the screenshot function that was returning a double resolution image. |
I've actually updated the lib with retina support, tell me how that goes for you :) |
Thank you so much for your quick response. I also commented the |
Huh, that's odd, can you save the screencap and see if your searched image is in it ? (uncomment im.save('testarea.png')) |
The size of the logo you're trying to find must match the size of the logo on the screencap. This is not a fancy machine learning image searching that will search things that resemble the input image. What opencv does is basically take the input image and then look for something of the same size and more or less the same colored pixels (this is what the tolerance parameter does btw). and if your input image is bigger than the one that's displayed, then it won't find it. here's an example of a screencap + logo that works : |
Here is an option: https://www.pyimagesearch.com/2015/01/26/multi-scale-template-matching-using-python-opencv/ But if you can click by a unique value (pixel) then you save a lot of cycles. You could even do a branching pixel check from a color to rule out other colors on the screen which may be the same. |
I searched for the position of an image, as your example shows, and if it is on the top-left corner the position is ok, but as it gets far from there, it will increase the coordinates even doubling them.
I divided them by 2 and it is close to the actual position but not enough:
I am using Mac OS, also I use 2 monitors, but the problem is still there if I only use one.
The text was updated successfully, but these errors were encountered: