hi, i'm now doing a program to calculate the pixels for the comparison between two images. both image should have the same size, 16 x 16 pixels, and in a matrices representation. any suggestion that could help me? does 2-dimensional array is reasonable? because if i do the 2-dimensional array, i need to declare 256 variables, and if suddenly i need to change the size into 24 x 24 pixels, it's gonna be more declaration.... could anyone can give a suggestion? thank you
Loading

Nilanka DharmadasaRank #1,875 · 794 reputationPosted Nov 25, 2009, 7:54 PM EST
As I feel, what you have done is correct. If you change the size of the matrix then definetely you will have to reassign the values of each and every pixel. I dont think you can stop that by using another way.
You can use a class like this. So you can set the values from outside according to OOP concepts.
public class MyImage { private int _ImageSize = 16; private double[,] _Matrix; public MyImage(int imgsize) { _ImageSize = imgsize; _Matrix = new double[_ImageSize, _ImageSize]; } public double this[int x, int y] { get { return _Matrix[x, y]; } set { _Matrix[x, y] = value; } } }Mark Do you like this answer checkbox if this helps you.