本文介绍了Java在屏幕上找到图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们可以给我一些关于如何在屏幕上找到图像的提示。我的意思是,一个简单的像素组合。例如,它找到30x30像素白色方块的坐标。

Can you guys give me hints on how to find a image on screen. I mean, a simple pixel combination. For exmaple, it finds coordinates of 30x30 pixel white square.

Java机器人类允许我找到某些像素的颜色。但我需要反对,我希望我的程序扫描我的屏幕,然后告诉我这个小图像的坐标。好吧,我可以通过机器人检查所有像素,但它应该比这更快。更快。

Java robot class allows me to find color of certain pixel. But i need to opposite, I want my program to scan my screen and then tell me the coords of this little image. Well I could go through all pixels with Robot, but it should be faster than that. Much faster.

有任何建议吗?

推荐答案

我担心这正是你必须要做的。

I'm afraid that that's precisely what you'll have to do.

如果所有像素都应为白色,则可以先取30个像素宽的步长,如果找到白色像素,则说5个像素步长,然后如果这些像素也是白色,请检查剩余像素广场。

If all pixels should be white, you could first take 30 pixel wide steps and if you find a white pixel, take say, 5 pixel steps, and then if these pixels are white too, examine the remaining pixels in the square.

这样的事情:

.        .        .        .        .        .



.        ..........        .        .        .
         ...... 
         .  .  .  .

         .  .  .  .
.        .        .        ..........        .
                           ..........
                           ..........
                           ..........
                           ..........
.        .        .        ..........

这篇关于Java在屏幕上找到图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 23:49