drov0 / python-imagesearch

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

I have an error #38

Closed hom-song closed 3 years ago

hom-song commented 3 years ago

I have pasted all the examples and put in the correct image address.

* from imagesearch import

count = imagesearch_count("./dex61.png") print(count) **

But this code doesn't work. and I get the following error in terminal

* from imagesearch import

count = imagesearch_count("./dex61.png") print(count) **

drov0 commented 3 years ago

Give me the actual error you pasted the same code twice.

hom-song commented 3 years ago

Traceback (most recent call last): File "c:\Users\home9\Desktop\mr\asd2.py", line 5, in count = imagesearch_count("./github.png") File "c:\Users\home9\Desktop\mr\imagesearch.py", line 228, in imagesearch_count img_rgb = sct.grab() TypeError: grab() missing 1 required positional argument: 'monitor'

drov0 commented 3 years ago

I see, here's an issue with the lib line 234

img_rgb = sct.grab() should be sct.grab(sct.monitors[0])

I'll push a fix today, meanwhjile you can update the file yourself if you feel like it

hom-song commented 3 years ago

cool! thank you bruh ;)

drov0 commented 3 years ago

Actually there seems to be more issues due to the change to mss. I'll keep you posted when I have a solution.

drov0 commented 3 years ago

@maerongmaerong okay it's just that count is very sensitive, you should set a very high tolerance value like 0.95 or higher otherwise, it will match more than anticipated.