getRGB

Discussion in 'Java' started by patrick, Jul 1, 2004.

  1. patrick

    patrick Guest

    Im using getRGB in a java application to identify a particular image from
    a (non java) windows application. I take a screenshot and use the method
    below.
    When I get a known value or very close to it I know that a particular image
    is showing.

    This all works perfectly on my own PC. But on a second PC the windows
    application looks different and I fail to identify the image.


    Im not sure there is an easy or any solution to this.
    presumably one gets different values from getRGB depending on which version
    of Windows. (im not interested in other platforms)
    Is there a way of identifying the native 'look and feel' of this non java
    application? and would there be a way of converting an RGB values.?

    thanks
    patrick


    [The java application on my PC has the java look and feel and on the second
    metal I think. It uses getSystemLookAndFeelClassName() ]

    //return a number identifying the image within the rect =area in image1.:
    public long getrgb (BufferedImage image1,Rectangle area)
    { long myRGB=0L,x=0L;
    for(int i=area.x;i<(area.x+area.width);i++)
    {
    for(int j=area.y;j<(area.y+area.height);j++)
    { x=(long)image1.getRGB(i,j);
    myRGB=myRGB + x;
    } //
    } // end for width
    myRGB= myRGB/1000000L;
    return myRGB;
    }
     
    patrick, Jul 1, 2004
    #1
    1. Advertising

  2. "patrick" <> wrote in message
    news:beTEc.3613$...
    > Im using getRGB in a java application to identify a particular image
    > from
    > a (non java) windows application. I take a screenshot and use the method
    > below.
    > When I get a known value or very close to it I know that a particular
    > image
    > is showing.


    If you want to get information about a process running on a users computer
    (I assume it's identifying the process that you're interested in, in some
    part, and that the image recognition is a step towards that), then try JNI.
    There are probably a large number of Microsoft APIs that will return process
    information, WMI is one of them:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_process.asp

    --
    Elliott C. Bäck
     
    Elliott C. Bäck, Jul 1, 2004
    #2
    1. Advertising

  3. patrick

    patrick Guest

    No not interested in that at all.
    Just identifying an image at a particular time is what Im doing. So I can
    press buttons remotely from java application.
    patrick

    "Elliott C. Bäck" <> wrote in message
    news:cc16br$otu$...
    > "patrick" <> wrote in message
    > news:beTEc.3613$...
    > > Im using getRGB in a java application to identify a particular image
    > > from
    > > a (non java) windows application. I take a screenshot and use the method
    > > below.
    > > When I get a known value or very close to it I know that a particular
    > > image
    > > is showing.

    >
    > If you want to get information about a process running on a users computer
    > (I assume it's identifying the process that you're interested in, in some
    > part, and that the image recognition is a step towards that), then try

    JNI.
    > There are probably a large number of Microsoft APIs that will return

    process
    > information, WMI is one of them:
    >
    >

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_process.asp
    >
    > --
    > Elliott C. Bäck
    >
    >
     
    patrick, Jul 1, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. patrick

    getRGB

    patrick, May 20, 2004, in forum: Java
    Replies:
    0
    Views:
    840
    patrick
    May 20, 2004
  2. royG
    Replies:
    3
    Views:
    578
    Mayeul
    Nov 17, 2008
  3. preventsmash

    Help with .getRGB() method

    preventsmash, Dec 15, 2009, in forum: Java
    Replies:
    0
    Views:
    727
    preventsmash
    Dec 15, 2009
Loading...

Share This Page