Hi,
Well without going into to much depth, an int is a simple value. It is easy to copy and is why we can say int a = b; However and int[] array is a technically a complex structure which is not cloneable directly. The reason Microsoft don't allow this automatically is simply down to time and space. You have to in effect copy each value in the array and if where talking images or a "
Multidimensional Array" i.e. int[640,320] thats 204'800 integers to copy which takes time and takes up twice the amount of space.
Microsoft prevent this over-site by automatically passing a reference to the array. It is designed to prevent new programmers from killing the system by eating all the resources.
As far as I am aware Microsoft do not allow multidimensional arrays to be copied automatically. So you have to copy each element yourself here is the code:
private int[,] copy_array (int[,] Input_array, int array_width, int array_height)
{
int[,] array_copy = new int[array_width, array_height];
for (int i = 0; i < array_width; i++)
{
for (int j = 0; j < array_height; j++)
{
array_copy[i, j] = Input_array[i, j];
}
}
return array_copy;
}
So your code will look like this:
arrayG = gray(bm);
arrayN = noise(copy_array(arrayG,bm.Width, bm.Height));
arrayH = histogram(copy_array(arrayN,bm.Width, bm.Height));
arrayB = binary(copy_array(arrayH,bm.Width, bm.Height));
showPic(arrayG);
Take Care
Chris