Ejemplo n.º 1
0
 public NeighborForm()
 {
     InitializeComponent();
     ObjectSerializer<Neighbor> objSerializer = new ObjectSerializer<Neighbor>();
     Neighbor yourObjectFromFile = objSerializer.GetSerializedObject("Neighbor.bin");
     if (yourObjectFromFile != null)
     {
         neighbor = yourObjectFromFile;
     }
     else
     {
         MessageBox.Show("Not reasy");
     }
 }
Ejemplo n.º 2
0
 public PerceptronViewer()
 {
     InitializeComponent();
     lform.FormClosing += Lform_FormClosing;
     ObjectSerializer<Perceptron> objSerializer = new ObjectSerializer<Perceptron>();
     Perceptron yourObjectFromFile = objSerializer.GetSerializedObject(PathObjectSerializer);
     if (yourObjectFromFile != null)
     {
         per = yourObjectFromFile;
     }
     else
     {
         per = new Perceptron(6400, 3200);
     }
     Load += PerceptronViewer_Load;
 }
Ejemplo n.º 3
0
        private BestSampleAlgorithm GetObjectBestSampleAlgorithm()
        {
            BestSampleAlgorithm bestAlgorithm = new BestSampleAlgorithm();

            try
            {
                ObjectSerializer <BestSampleAlgorithm> objSerializer = new ObjectSerializer <BestSampleAlgorithm>();
                BestSampleAlgorithm yourObjectFromFile = objSerializer.GetSerializedObject(SerializePathObject);
                if (yourObjectFromFile != null)
                {
                    bestAlgorithm = yourObjectFromFile;
                }
                else
                {
                    bestAlgorithm = null;
                }
            }
            catch (Exception) { }
            return(bestAlgorithm);
        }
Ejemplo n.º 4
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     ObjectSerializer<Perceptron> objSerializer = new ObjectSerializer<Perceptron>();
     Perceptron yourObjectFromFile = objSerializer.GetSerializedObject(PathObjectSerializer);
     if (yourObjectFromFile != null)
     {
         per = yourObjectFromFile;
     }
     else
     {
         MessageBox.Show("Perceptron not trained");
     }
 }
Ejemplo n.º 5
0
 //save collection image
 private void DividedIntoImageButton_Click(object sender, EventArgs e)
 {
     ObjectSerializer<Perceptron> objSerializer = new ObjectSerializer<Perceptron>();
     Perceptron yourObjectFromFile = objSerializer.GetSerializedObject(PathObjectSerializer);
     if (yourObjectFromFile != null)
     {
         per = yourObjectFromFile;
     }
     else
     {
         MessageBox.Show("Perceptron not trained");
     }
     Segmentation segment = new Segmentation(null, null);
     numberImageCollection = segment.GetCollectionofImage(DividedImageList, DividedImage);
     ImageFormat format = ImageFormat.Bmp;
     SaveFileDialog saveFileDialog = new SaveFileDialog();
     if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         int x = 0;
         DividedimageList1.ImageSize = new Size(50, 50);
         foreach (var item in numberImageCollection)
         {
             item.bitmap.Save(saveFileDialog.FileName + item.Name + ".bmp", format);
             DividedimageList1.Images.Add(Image.FromFile(saveFileDialog.FileName + item.Name + ".bmp"));
             DividedListView.Items.Add("image", x++);
         }
         DividedListView.LargeImageList = DividedimageList1;
     }
 }
Ejemplo n.º 6
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (numberImageCollection != null)
     {
         NeighbLable.Text = "";
         Neighbor neir = new Neighbor();
         ObjectSerializer<Neighbor> objSerializer = new ObjectSerializer<Neighbor>();
         Neighbor yourObjectFromFile = objSerializer.GetSerializedObject("Neighbor.bin");
         if (yourObjectFromFile != null)
         {
             neir = yourObjectFromFile;
         }
         else
         {
             MessageBox.Show("Neighbor not trained");
         }
         foreach (var item in numberImageCollection)
         {
             NeighbLable.Text = NeighbLable.Text + neir.NameClass(item.bitmap);
         }
     }
     else
     {
         MessageBox.Show("Collection image empty");
     }
 }