Results 1 to 6 of 6
Thread: pixel scanning too slow
- 08-20-2010, 07:50 PM #1
Senior Member
- Join Date
- Jul 2010
- Posts
- 124
- Rep Power
- 0
color pixel (robot class) scanning too slow
I am making a program that scans randomly for pixels on the screen. It uses the robot class to check (robot.getPixelColor(x,y)) each pixel it randomly hops to. The problem is: It is TOO SLOW. I heard you can use BufferedImages, Rasters,etc. Can someone point me to the right direction? Thanks!
Last edited by crikey; 08-20-2010 at 08:10 PM.
- 08-21-2010, 01:59 AM #2
Senior Member
- Join Date
- Jul 2010
- Posts
- 124
- Rep Power
- 0
Nevermind. I solved it. I had to use Raster to get a int[] array.
- 08-21-2010, 02:27 AM #3
I've seen this question posted before, can you post the code that gets the int[] array?
- 08-21-2010, 03:08 AM #4
Senior Member
- Join Date
- Jul 2010
- Posts
- 124
- Rep Power
- 0
The value 'R' is tst[0], G is tst[1] and B is tst[2]Java Code:Rectangle screenRect = new Rectangle(0, 0, Toolkit.getDefaultToolkit() .getScreenSize().width, Toolkit.getDefaultToolkit() .getScreenSize().height); BufferedImage grid = robot.createScreenCapture(screenRect); int X = random(0, Toolkit.getDefaultToolkit().getScreenSize().width); int Y = random(0, Toolkit.getDefaultToolkit().getScreenSize().height); int tst[] = null; Raster k; k = grid.getData(); tst = k.getPixel(X, Y, tst); //X = the x pixel, Y = the y pixel
- 08-21-2010, 03:34 AM #5
Thanks for the code.
- 08-21-2010, 03:49 AM #6
Senior Member
- Join Date
- Jul 2010
- Posts
- 124
- Rep Power
- 0
Similar Threads
-
Scanning Image Pixel by Pixel
By the_transltr in forum Advanced JavaReplies: 5Last Post: 08-28-2012, 04:01 PM -
compare two images pixel by pixel
By java_bond in forum Advanced JavaReplies: 6Last Post: 03-02-2010, 11:27 AM -
Scanning in java
By Waqas in forum Advanced JavaReplies: 1Last Post: 07-10-2009, 08:38 AM -
scanning a file and using more than one delimiter
By thomase in forum New To JavaReplies: 20Last Post: 04-07-2009, 03:04 AM -
Java Twain Scanning
By mwalstra in forum Advanced JavaReplies: 3Last Post: 12-09-2008, 11:49 AM


LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks