Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By Norm

Thread: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible?

  1. #1
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Question 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

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible

    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.

  3. #3
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Default Re: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible

    Quote Originally Posted by pbrockway2 View Post
    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.
    Last edited by JeffThomas; 12-03-2011 at 07:25 AM.

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,577
    Rep Power
    25

    Default Re: Java Robot: Getting the X, Y location of a pixel with a certain color. Impossible

    location where it found the specific colored pixel
    Does that location have x,y values that you can use with mouseMove()?
    DarrylBurke likes this.

Similar Threads

  1. Replies: 4
    Last Post: 11-08-2011, 05:04 AM
  2. Replies: 1
    Last Post: 11-08-2011, 05:04 AM
  3. Find Pixel With RGB Color?
    By TyCox94 in forum JDBC
    Replies: 8
    Last Post: 09-23-2011, 04:20 AM
  4. can you ask the color of one pixel?
    By liluma in forum New To Java
    Replies: 7
    Last Post: 09-06-2011, 07:53 PM
  5. Replies: 3
    Last Post: 06-27-2010, 02:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •