private void bnRecognizeB_Click(object sender, EventArgs e) { double[] task = RawSample.BitmapToInputs(bmpB, sqareSideLengthB, sqareSideLengthB); double[] result; result = RecognizeBtoA(task); ClearField(ref bmpA); digitizedA = result; labelRound.Text = string.Format("Stabilized in {0} rounds.", round); pictureBox1.Refresh(); }
private void bnRecognize_Click(object sender, EventArgs e) { double[] task = RawSample.BitmapToInputs(bmp, nx, ny); double[] result = charNet.FeedForward(task); char[] ans = chars.ToCharArray(); Array.Sort(result, ans); txtAnswer.Text = ans[ans.Length - 1].ToString(); labelSure.Text = (result[ans.Length - 1] * 100).ToString("F5") + "%"; //Debug.Print(result.ToString()); }
private void pictureBox1_Paint(object sender, PaintEventArgs e) { if (showDigitized) { SolidBrush br = (SolidBrush)Brushes.White; int dx = pictureBox1.Width / nx; int dy = pictureBox1.Height / ny; if (digitized == null) { digitized = RawSample.BitmapToInputs(bmp, nx, ny); } try { e.Graphics.DrawImageUnscaled(bmp, 0, 0); } catch { } for (int i = 0; i < nx; i++) { for (int j = 0; j < ny; j++) { int brightness = (int)(digitized[i * nx + j] * 254.0); br.Color = Color.FromArgb(brightness, 255, 255, 255); // brightness, brightness, brightness e.Graphics.FillRectangle(br, i * dx, j * dy, dx, dy); } } } else { try { e.Graphics.DrawImageUnscaled(bmp, 0, 0); } catch { } } }
private void pbPaint(PictureBox sender, Bitmap bmp, int n, ref double[] digitized, Graphics g) { if (showDigitized) { SolidBrush br = (SolidBrush)Brushes.White; int dx = sender.Width / n; int dy = sender.Height / n; if (digitized == null) { digitized = RawSample.BitmapToInputs(bmp, n, n); } try { g.DrawImageUnscaled(bmp, 0, 0); } catch { } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int brightness = (int)(digitized[i * n + j] * 125.0 + 125.0); br.Color = Color.FromArgb(brightness, 255, 255, 255); // brightness, brightness, brightness g.FillRectangle(br, i * dx, j * dy, dx, dy); } } } else { try { g.DrawImageUnscaled(bmp, 0, 0); } catch { } } }
public double[] BitmapToInputs(int nx, int ny) { return(RawSample.BitmapToInputs(this.bitmap, nx, ny)); }