im trying to make my code detect an image on the screen
while 1:
try:
if pyautogui.locateOnScreen('drillpoint1.png') or pyautogui.locateOnScreen('drillpoint1_mining.png') or pyautogui.locateOnScreen('drillpoint2.png') or pyautogui.locateOnScreen('drillpoint2_mining.png') is not None:
print("Yes")
time.sleep(0.5)
except pyautogui.ImageNotFoundException:
print("No")
time.sleep(0.5)
it always prints no because it does not find the exact image, but when i try adding confidence
while 1:
try:
if pyautogui.locateOnScreen('drillpoint1.png', confidence=0.8) or pyautogui.locateOnScreen('drillpoint1_mining.png', confidence=0.8) or pyautogui.locateOnScreen('drillpoint2.png', confidence=0.8) or pyautogui.locateOnScreen('drillpoint2_mining.png', confidence=0.8) is not None:
print("Yes")
time.sleep(0.5)
except pyautogui.ImageNotFoundException:
print("No")
time.sleep(0.5)
i get this error: NotImplementedError: The confidence keyword argument is only available if OpenCV is installed.
So when i try to instal opencv with "pip install opencv-python" i get this error:
error: metadata-generation-failed
ร Encountered error while generating package metadata.
โฐโ> numpy
note: This is an issue with the package mentioned above, not pip."
i dont know how to fix