Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible?
I was working on an artistic demonstrative program that makes used of Java's Robot Class, Robot (Java 2 Platform SE v1.4.2) .
Basically, I ran into a couple of speed bumps where I wanted to have the program draw a specific pattern going from different colors.
I already know how to find those pixels on the screen, get their pixel colors (Red, Green Blue), and store them in an array if I wanted, but I haven't ever learned about a method to have the robot point the mouse (mouseMove(x,y)) at the location of that pixel where it found that specific color.
For Example:
If my program scans the screen and finds a pixel with a color value of [Red = 122, Blue = 89, Green = 34], how can I get the X,Y location of where that specific pixel was found at?
I've tried many methods and techniques of trying to accomplish this, but nothing has worked so far.
In essence, I need the x,y location of a pixel that has a certain color. Impossible?
If anyone here has specific knowledge in this field of java , help me out :beer:
Re: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible
Quote:
If my program scans the screen and finds a pixel with a color value of [Red = 122, Blue = 89, Green = 34], how can I get the X,Y location of where that specific pixel was found at?
I'm missing something here... You say you find a pixel, but then say you don't have X/Y coordinates. Isn't that what "finding" is? Perhaps you could post the code that finds the pixel.
Re: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible
Quote:
Originally Posted by
pbrockway2
I'm missing something here... You say you find a pixel, but then say you don't have X/Y coordinates. Isn't that what "finding" is? Perhaps you could post the code that finds the pixel.
Sorry for the confusing explanation.
I meant that I scan the screen and get the color values of every pixel on it.
I want my robot to do a mouse move to the location where it found the specific colored pixel I was looking for. (mouse move to Red 34, Green 52, Blue 10)
However the mouseMove(int x, int y) method of the robot class does not take color values - only X and Y coordinates.
There is only one concept I can think of in the area Artificial Intelligence that might be able accomplish something like this - a neural network that is able to distinguish between the "bad pixels" and the ones I want the robot to mouseMove to.
Re: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible
Quote:
location where it found the specific colored pixel
Does that location have x,y values that you can use with mouseMove()?