I don't know but for some reason an array refuses to change and i have no idea why. see further comments below
public static void contour (int[ ][ ][]image, int rows, int cols, int maxIntensity, int[ ][ ][]newImage) throws Exception
{
PrintWriter contour = new PrintWriter("contour.ppm");
int r = 0;
int c = 0;
int a = 0;
int sumk = 0;
while (r < rows && c < cols)
{
while (a < 3)
{
image[0][r][a] = newImage[0][r][a];
image[cols-1][r][a] = newImage[cols-1][r][a];
image[c][0][a] = newImage[c][0][a];
image[c][rows-1][a] = newImage[c][rows-1][a];
a++;
}
r++;
c++;
}
System.out.println (image[32][0][2]);
System.out.println (newImage[32][0][2]);
}
This code is a bit out of context, but you should be able to see which values I want to make the same in both arrays. The print statements are for testing purposes, and for some reason i get two different values. These arrays both have values assigned to them, but the image array will not change (and even when I create a new array in this method the same problem persists).
You can see that I define these arrays in the main method and they are as follows:
int image [][][] = readimage (fname, descriptor);
int newImage [][][] = new int [rows][cols][3];
So the image array is a returned array from a different method.
Am I overlooking something extremely obvious or what? I have been struggling with this for quite some time, so all hints, tips and explanations are greatly appreciated!!
forloops for this? Have you confirmed that your loops actually affect the element at[32][0][2]?newImage[0][r][a] = image[0][r][a];??