Ejemplo n.º 1
0
        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            Risovatel.Painter(e, Graphics.FromImage(cartina));
            pictureBox1.Image = cartina;

            IsClicked = true;
        }
Ejemplo n.º 2
0
 private void panel1_MouseMove(object sender, MouseEventArgs e)
 {
     if (IsClicked)
     {
         Risovatel.Painter(e, Graphics.FromImage(cartina));
     }
     pictureBox1.Image = cartina;
 }
Ejemplo n.º 3
0
        private void panel1_MouseUp(object sender, MouseEventArgs e)
        {
            if (IsClicked)
            {
                Risovatel.Painter(e, Graphics.FromImage(cartina));
                pictureBox1.Image = cartina;

                vectorBitmap      = new Bitmap(Risovatel.ResizeImageMinImage(cartina, 15));
                pictureBox2.Image = Risovatel.ResizeImageMaxImage(vectorBitmap, 300);
                var arr = Parser.BMPToArray(vectorBitmap);
                vector = Parser.ArrayToVector(arr);

                IsClicked = false;
            }
        }
Ejemplo n.º 4
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (bazaZnaniy.Brain == null)
            {
                bazaZnaniy.CreateNewBrain(vector.Length); //если персептрона нет, создаем новый
            }
            var vyborka = new Bitmap("vyborkaTraining.bmp");
            var y       = 0;
            var width   = 16;
            var height  = 20;
            var chars   = "0123456789abcdefghijklmnopqrstuvwxyz";

            TrainingSet.Chars   = new List <string>();
            TrainingSet.Vectors = new List <int[]>();
            foreach (var bukva in chars)
            {
                for (var i = 0; i < 39; i++)
                {
                    var oblastClone = vyborka.Clone(new Rectangle(i * (width + 3), y, width, height),
                                                    vyborka.PixelFormat);
                    var currentImg = new Bitmap(20, 20);
                    var gr         = Graphics.FromImage(currentImg);
                    gr.FillRectangle(new SolidBrush(Color.White), 0, 0, 20, 20);
                    gr.DrawImage(oblastClone, new Rectangle(2, 0, width, height));
                    currentImg = Risovatel.ResizeImageMinImage(currentImg, 15);
                    var vect = Parser.ArrayToVector(Parser.BMPToArray(currentImg));
                    TrainingSet.Chars.Add(bukva.ToString());
                    TrainingSet.Vectors.Add(vect);
                }
                y += 23;
            }

            bazaZnaniy.TrainingFromFile();
            button2.Enabled = true;
            MessageBox.Show("OK");
        }