/// <summary> /// Buttons the statistics click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void ButtonStatisticsClick(object sender, EventArgs e) { if (picturePath == null) { MessageBox.Show(Resources.ApplicationForm_ButtonStatisticsClick_Choose_picture_); return; } var helper = new NeuronHelper(); var picture = new PictureContainer(picturePath, 13); var vector = helper.ConvertToVector(picture); var network = new HopfieldNetwork(); var thread = new Thread(() => ChooseCorrectVector(network, vector), 214748364); thread.Start(); thread.Join(); picture.Picture.Dispose(); }
/// <summary> /// Chooses the correct vector. /// </summary> /// <param name="network">The network.</param> /// <param name="vector">The vector.</param> private void ChooseCorrectVector(HopfieldNetwork network, sbyte[] vector) { network.StartRecognize(vector); var vectorNumber = network.CorrectVector; switch (vectorNumber) { case 0: { textBoxStatistics.Text += @"It's an A picture." + Environment.NewLine; textBoxStatistics.Text += @"Number of iterations: " + network.NumberOfIterantions + Environment.NewLine; ScrollTextBox(); break; } case 1: { textBoxStatistics.Text += @"It's a B picture." + Environment.NewLine; textBoxStatistics.Text += @"Number of iterations: " + network.NumberOfIterantions + Environment.NewLine; ScrollTextBox(); break; } case 2: { textBoxStatistics.Text += @"It's a C picture." + Environment.NewLine; textBoxStatistics.Text += @"Number of iterations: " + network.NumberOfIterantions + Environment.NewLine; ScrollTextBox(); break; } default: { textBoxStatistics.Text += @"It's unknown picture." + Environment.NewLine; textBoxStatistics.Text += @"Number of iterations: " + network.NumberOfIterantions + Environment.NewLine; ScrollTextBox(); break; } } }