Identifying something on screen.
I want to be able to return the coordinates of small image on my screen, how can I go about sensing its location and returning those coordinates? For example if I wanted to make the Robot class click on this :eek: no matter where I move it on the screen.
Re: Identifying something on screen.
I would use the following algorithm:
0. Convert a sample image in a BufferedImage - just so you can compare.
1. For each pixel on the screen:
1.1. Create screenshot of a rectangular part of a screen with the upper left corner in this pixel and dimensions equal to your target image ones. You can do that with Robot.createScreenCapture.
1.2. Use BufferedImage.getRGB to get array of RGB data
1.3. Use similar function on your sample image from (0)
1.4. Compare (1.2.) and (1.3.) to first (bunch) of failures. If failed (n times) - go to the next pixel, if not - return the coordinates.
Or, for instance, you can use some neural network libs for image recognition.