Ok, I need to create two arrays like this:
double[][] TrainPatterns = {
new double[] { 0.0, 0.0 },
new double[] { 0.0, 1.0 },
new double[] { 0.0, 2.0 }
};
double[][] TrainResults = {
new double[] { 0.0 },
new double[] { 1.0 },
new double[] { 1.0 }
};
But with 100 items each.
I am reading the values for arrays from an image (TrainPatterns contains x and y coordinates of a pixel, TrainResults contains the color of the pixel, 0 for black, 1 for white).
I am iterating through the image like this:
Bitmap objBitmap = new Bitmap("im.bmp");
for (int y = 0; y < objBitmap.Height; y++)
{
for (int x = 0; x < objBitmap.Width; x++)
{
// here I need to insert new double[] { (double)x, (double)y } to the
// TrainPatterns array
Color col = objBitmap.GetPixel(x, y);
if (col.R == 255 && col.G == 255 && col.B == 255)
{
// white color
// here I need to insert new double[] { 1.0 } to the
// TrainResults
}
if (col.R == 0 && col.G == 0 && col.B == 0)
{
// black color
// here I need to insert new double[] { 0.0 } to the
// TrainResults
}
}
}
How can I add items to those arrays dynamically in the for loop? I know that image has 10px width and 10px height so I know the arrays will both have 100 length.
double[]? Couldn't you just use adouble? 3) Could you use the bitmap itself as the data structure, using GetPixel and SetPixel as the accessors? 4) Alternatively, could you store the entire bitmap as two longs (with space enough for 128 bits)?