I am writing a program which which will divide an image into domains and ranges. In this domain will be 16X16 matrix. I am using PixelGrabber
to acquire the pixels. I have used for loop for the iteration but it is taking so much time to process.In java any alternate is there to reduce this time. I need a better performance. Whether we can use any collections for that?
My code is:
int[] pix = new int[16 * 16];
long start = System.nanoTime();
for (int i = 0; i < 512; i += 16)
{
for (int j = 0; j < 512; j += 16)
{
PixelGrabber pg = new PixelGrabber(Im, i, j, 16, 16, pix, 0, 16);
pg.grabPixels();
makeStack(pix, i, j);
}
}
long end = System.nanoTime();