通过图像匹配查找图像在屏幕上的位置

发布于 2024-10-05 00:17:39 字数 527 浏览 5 评论 0原文

我目前正在尝试用 Java 编写一个程序,该程序将执行一些宏,但是我需要这些宏能够找到屏幕上的某些图片。

Macro Schedule中有一个函数,差不多是FindImagePos(myimage.bmp,tolerance(0-255)),可以在1080P下大约0.2秒内定位图像,但在Macro Scheduler中编写该程序会很痛苦。 除了轻微的颜色变化之外,图像不会以任何方式扭曲,这是容差的来源,

例如。找到这个:http://min.us/idivEC.png 在这些栏的每一处 min.us /iR64a.png

我认为我无法有效地编写这样的函数,并简要浏览了 ImageJ 和 Neuroph,它们看起来很复杂且过大,想知道是否有更简单的东西。

关于如何编码的唯一理论是截取屏幕截图,将其转换为 2D RGB 数组,在行中搜索示例图像中第一行的出现情况,并具有一定的宽容度(也称为容差),如果它在某种程度上匹配,则检查该行下方是否有第二行,依此类推。

I'm currently trying to write a program in Java which will preform some macros however I need the macros to be capable of finding certain pictures located on my screen.

There is a function in Macro Schedule which is pretty much FindImagePos(myimage.bmp, tolerance(0-255)) and locates the image in about 0.2s at 1080P but the program would be a pain to code in Macro Scheduler.
The images are not distorted in any way except for slight color variations which is where tolerance comes in,

ex. finding this: http://min.us/idivEC.png in every one of these bars min.us/iR64a.png

I don't think I could code such a function efficiently and briefly skimmed ImageJ and Neuroph which seemed complicated and overkill and would like to know if there was something simpler.

The only theory on how to code this would be to take screenshot, convert it into a 2D RGB array, search the rows for the occurrence of the first row in the sample image with some leniency (aka tolerance) and if it matches up somewhat then check underneath the row for the second row and so on.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文