Does anyone have any advice on a faster method for checking every single pixel in an entire image?
I’m doing a few coding tests, and I want to experiment with putting pixel data into a 2d byte array, but I’d like to speed up the process a bit, just wondering if anyone has any tricks up their sleeve.
Basically my method runs 2 for loops and line by line/pixel by pixel snags the data on each pixel 1 by 1 and stuffs it in an array. The images it’s dealing with are only 2 color images, red and black.
for(int x = 0; x < image.getWidth(); x++){
for( int y = 0; y < image.getHeight(); y++){
if (image.getColor(x, y).getRed() == 255){
byteArray[x][y] = 1;
}else{
byteArray[x][y] = 0;
}
}
}
Just wondering if anyone else has any tricks up their sleeve for grabbing all the X/Y coordinates of one specific color on an image that may be faster.