Пример #1
0
 private byte[,] loadMatrix(Digit d)
 {
     btp = (Bitmap)im;
     Color pixelColor;
     byte[,] result = new byte[MATRIX_SIZE, MATRIX_SIZE];
     for (int i = 0; i < im.Width; ++i)
         for (int j = 0; j < im.Height; ++j)
         {
             pixelColor = btp.GetPixel(i, j);
             if (pixelColor.A > 0 && pixelColor.R > 127 && pixelColor.G > 127 && pixelColor.B > 127)
                result[i, j] = 1;
             else
                 result[i, j] = 0;
         }
     return result;
 }
Пример #2
0
 private Digit generateDigit()
 {
     Random rnd = new Random();
     Digit d = new Digit(rnd.Next(0, 10), 0, 0);
     return d;
 }