Ejemplo n.º 1
0
 private void buttonNeural2_Click(object sender, EventArgs e)
 {
     Form3 frm3 = new Form3();
     frm3.showForm();
 }
Ejemplo n.º 2
0
        private void buttonRecognize_Click(object sender, EventArgs e)
        {
            Bitmap inImage = snapPicture;
            Bitmap outImage = ImageBinarization(inImage);
            pictureBoxVideo.Image = outImage;
            //Rect.Width = Rect.Height = 0;
            MessageBox.Show("Binarized");

            median.Size = 3;
            median.ApplyInPlace(outImage);

            outImage = adaptBinarizedImage(outImage);

            pictureBoxVideo.Image = outImage;
            MessageBox.Show("Filtered");

            snapPicture = outImage;

            //Some magic
            FindObjects();
            int imagesCount = foundImagesArray.Count();
            MessageBox.Show(imagesCount + " objects are found. Ready to recognize");

            //Recognizing for each bitmap number
            Form3 frm3 = new Form3();
            neuralNetworkClass neuralClass = new neuralNetworkClass();
            double[,] weightsArray;
            List<int> foundNumList = new List<int>();
            //Obtaining weights array
            neuralClass.DeserializeWeightsArray();
            weightsArray = neuralClass.GetWeightsArray();
            foreach (Bitmap bmp in foundImagesArray)
            {
                int classNum = 0;
                double outParam = 0.0;
                for (int i = 0; i < 10; i++)
                {
                    double temp = frm3.GetOutParam(i, weightsArray, bmp);
                    if (temp > outParam)
                    {
                        outParam = temp;
                        classNum = i;
                    }
                }
                foundNumList.Add(classNum);
            }
            String nums = "";
            foreach (int number in foundNumList)
            {
                nums += number.ToString() + " ";
            }
            textBoxRecognized.Text = nums;

            //Form2 frm2 = new Form2(this);
            //frm2.showForm();

            //foreach (Bitmap bmp in foundImagesArray)
            //{
            //    frm2.setImage(bmp);
            //    MessageBox.Show("Are found ;)");
            //}
        }
 public neuralNetworkClass(Form3 form3)
     : this()
 {
     // TODO: Complete member initialization
     this.form3 = form3;
 }