drov0 / python-imagesearch

A wrapper around opencv2 and pyautogui to do image searching easily.
MIT License
279 stars 98 forks source link

Image should be found, but is not :/ #17

Open tgeorgel opened 4 years ago

tgeorgel commented 4 years ago

Hi, i'm following your tutorial on Medium.

I'm kinda lost, the script can't find the image that should easily be found.

Here is the screen shot taken by pyautogui

testarea

And here is my lookup image :

sort_pression

The image fit perfectly it photoshop.. but can't be found by the script :

pos = imagesearch("img/sort_pression.png")

print(pos)

if pos[0] != -1:
    print("position : ", pos[0], pos[1])
    pyautogui.moveTo(pos[0], pos[1])
else:
    print("image not found")

And result :

❯ python3 main.py                                                                                                                                                              
[-1, -1]
image not found

Any idea of what i can't be doing wrong ?

I tested this on a macbook retina, the is_retina is set to 1..

Thanks a lot :)

drov0 commented 4 years ago

Hello,

First of all, friendly advice, don't post screenshots where your character's username is visible when wanting to make a bot, you're basically asking for a ban.

Now onto the actual issue, it may be an issue with github that resizes images, but the icon you provided is 76x76 whereas on the image you provided, the size of the same icon is closer to 36x36.

Could be that the screenshot is wrongly done. Or perhaps it's github, send me an imgur link or an email with the actual high res screenshot if that doesn't work.

merlinnaidoo commented 3 years ago

Hi,

i have come across imagesearch and am trying to research finding different sizes of images on screen due to resolutions changes, pixels and others. i took an initial screenshot (exampletwoworking.png) and then i increased size(exampletwoedit.png) of it and i am trying to find the larger image onscreen and click on it. imagesearch doesnt find the image. i think it may be related to this question. thank you Exampletwoedit Exampletwoworking

Jotarokudjo1 commented 1 year ago

pls help me, code : `from python_imagesearch.imagesearch import imagesearch_numLoop import pyautogui

while True:

circle = imagesearch_numLoop("F.png", 829, 776)
if circle[0] != -1:
    print("position :", circle[0], circle[1])
    pyautogui.keyDown('f')
    pyautogui.PAUSE = 4
    pyautogui.keyUp('f')`

Error: C:\Users\zxc\PycharmProjects\pythonProject2\venv\Scripts\python.exe C:\Users\zxc\PycharmProjects\pythonProject2\main.py F.png not found, waiting