简体   繁体   中英

python image search in a particular area (coordinates)

I want to know how can I find these coordinates, which means how can I target a specific area on-screen so the program only searches for the given image in that area.

from python_imagesearch.imagesearch import imagesearch

pos = imagesearcharea("./github.png", 0, 0, 800, 600)
if pos[0] != -1:
    print("position : ", pos[0], pos[1])
else:
    print("image not found")

please see this image: 截屏

I want to target a specific area on my screen

get your screen resolution (see this thread ) and then you can at least work with percentages. Otherwise you have to hardcode some numbers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM