getRGB

P

patrick

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;
}
 
E

Elliott C. Bäck

patrick said:
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
 
P

patrick

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top