P
patrick
Hello,
i use getRGB(i,j) to accumulate a number myRGB to decide if a particular
image is on the screen:
for each pixel:
{ x=(long)image1.getRGB(i,j);
myRGB=myRGB + x;
} //
So I get a fixed total ,myRGB, for a particular image at 1024 by 768.This
works fine to identify the image.
My problem is I get a different number for the same image at 800 by 600.
Ive no idea how they are related.
Maybe somebody could help.
Thanks
patrick
The full method is as follows:
//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;
}
i use getRGB(i,j) to accumulate a number myRGB to decide if a particular
image is on the screen:
for each pixel:
{ x=(long)image1.getRGB(i,j);
myRGB=myRGB + x;
} //
So I get a fixed total ,myRGB, for a particular image at 1024 by 768.This
works fine to identify the image.
My problem is I get a different number for the same image at 800 by 600.
Ive no idea how they are related.
Maybe somebody could help.
Thanks
patrick
The full method is as follows:
//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;
}