static IEnumerable <double[]> GetAllImages(Image[] bigs) { int w = 28; int h = 28; int size = 2072; for (int y = 0; y < size - h - 2; y += h) { for (int x = 0; x < size - w - 2; x += w) { Rectangle rec = new Rectangle(x, y, w + 1, h + 1); foreach (Image img in bigs) { yield return(Digitalizer.GetInput((Bitmap)img, x, y, 29, 29, c => c.B > 100).ToArray()); } } } }
private void button2_Click(object sender, EventArgs e) { //recon if (!Loaded) { MessageBox.Show("Załaduj sieć neuronową!", "Warning"); } double[] input = null; using (Bitmap cropped = Digitalizer.AutoCrop(UserBitmap)) { using (Bitmap sized = Digitalizer.Resize(cropped, 17, 20)) { using (Bitmap bm = new Bitmap(29, 29)) { Graphics gr = Graphics.FromImage(bm); gr.Clear(Color.White); gr.DrawImage(sized, 4, 4); input = Digitalizer.GetInput(bm, 0, 0, bm.Width, bm.Height, x => x.Name == "ff000000").ToArray(); } } } double[] output = Network.Pulse(input); DrawReconResults(output); }