简体   繁体   English

python 图像搜索特定区域(坐标)

[英]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.否则你必须硬编码一些数字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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