Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            AllocConsole();

            Network = new Network.Network(new Bitmap(@"C:\Users\Dimon\Desktop\LNU\Дипломна\Photo.jpg"));
        }
Ejemplo n.º 2
0
 private void ShowResult(Network.Network network)
 {
     textBox1.Text = Math.Round(network.ResultNeurons[0].Output, 3).ToString();
     textBox2.Text = Math.Round(network.ResultNeurons[1].Output, 3).ToString();
     textBox3.Text = Math.Round(network.ResultNeurons[2].Output, 3).ToString();
     textBox4.Text = Math.Round(network.ResultNeurons[3].Output, 3).ToString();
     textBox5.Text = Math.Round(network.ResultNeurons[4].Output, 3).ToString();
     textBox6.Text = Math.Round(network.ResultNeurons[5].Output, 3).ToString();
 }
Ejemplo n.º 3
0
        private void button6_Click(object sender, EventArgs e)
        {
            var network = Network.Load();

            Network = network;
        }
Ejemplo n.º 4
0
        private void DrawAllResult(Network.Network network)
        {
            var redbmp   = new Bitmap(44, 44);
            var greenbmp = new Bitmap(44, 44);
            var bluebmp  = new Bitmap(44, 44);

            for (int i = 0; i < 44; ++i)
            {
                for (int j = 0; j < 44; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Input_Red[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Input_Green[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Input_Blue[i, j])) % 255));
                }
            }

            pictureBox8.SizeMode  = PictureBoxSizeMode.StretchImage;
            pictureBox8.Image     = redbmp;
            pictureBox7.SizeMode  = PictureBoxSizeMode.StretchImage;
            pictureBox7.Image     = greenbmp;
            pictureBox10.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox10.Image    = bluebmp;

            redbmp   = new Bitmap(44, 44);
            greenbmp = new Bitmap(44, 44);
            bluebmp  = new Bitmap(44, 44);

            for (int i = 0; i < 44; ++i)
            {
                for (int j = 0; j < 44; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_11[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_11[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_11[i, j])) % 255));
                }
            }

            pictureBox1.Image = redbmp;
            pictureBox3.Image = greenbmp;
            pictureBox5.Image = bluebmp;

            redbmp   = new Bitmap(44, 44);
            greenbmp = new Bitmap(44, 44);
            bluebmp  = new Bitmap(44, 44);

            for (int i = 0; i < 44; ++i)
            {
                for (int j = 0; j < 44; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_12[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_12[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_12[i, j])) % 255));
                }
            }

            pictureBox2.Image = redbmp;
            pictureBox4.Image = greenbmp;
            pictureBox6.Image = bluebmp;

            redbmp   = new Bitmap(22, 22);
            greenbmp = new Bitmap(22, 22);
            bluebmp  = new Bitmap(22, 22);

            for (int i = 0; i < 22; ++i)
            {
                for (int j = 0; j < 22; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_21[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_21[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_21[i, j])) % 255));
                }
            }

            pictureBox11.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox13.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox15.SizeMode = PictureBoxSizeMode.StretchImage;

            pictureBox11.Image = redbmp;
            pictureBox13.Image = greenbmp;
            pictureBox15.Image = bluebmp;

            redbmp   = new Bitmap(22, 22);
            greenbmp = new Bitmap(22, 22);
            bluebmp  = new Bitmap(22, 22);

            for (int i = 0; i < 22; ++i)
            {
                for (int j = 0; j < 22; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_22[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_22[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_22[i, j])) % 255));
                }
            }

            pictureBox12.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox14.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox16.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox12.Image    = redbmp;
            pictureBox14.Image    = greenbmp;
            pictureBox16.Image    = bluebmp;

            redbmp   = new Bitmap(18, 18);
            greenbmp = new Bitmap(18, 18);
            bluebmp  = new Bitmap(18, 18);

            for (int i = 0; i < 18; ++i)
            {
                for (int j = 0; j < 18; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_31[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_31[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_31[i, j])) % 255));
                }
            }

            pictureBox17.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox19.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox21.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox17.Image    = redbmp;
            pictureBox19.Image    = greenbmp;
            pictureBox21.Image    = bluebmp;

            redbmp   = new Bitmap(18, 18);
            greenbmp = new Bitmap(18, 18);
            bluebmp  = new Bitmap(18, 18);


            for (int i = 0; i < 18; ++i)
            {
                for (int j = 0; j < 18; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_32[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_32[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_32[i, j])) % 255));
                }
            }

            pictureBox18.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox20.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox22.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox18.Image    = redbmp;
            pictureBox20.Image    = greenbmp;
            pictureBox22.Image    = bluebmp;

            redbmp   = new Bitmap(9, 9);
            greenbmp = new Bitmap(9, 9);
            bluebmp  = new Bitmap(9, 9);

            for (int i = 0; i < 9; ++i)
            {
                for (int j = 0; j < 9; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_41[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_41[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_41[i, j])) % 255));
                }
            }

            pictureBox23.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox25.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox27.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox23.Image    = redbmp;
            pictureBox25.Image    = greenbmp;
            pictureBox27.Image    = bluebmp;

            redbmp   = new Bitmap(9, 9);
            greenbmp = new Bitmap(9, 9);
            bluebmp  = new Bitmap(9, 9);

            for (int i = 0; i < 9; ++i)
            {
                for (int j = 0; j < 9; ++j)
                {
                    redbmp.SetPixel(i, j, Color.FromArgb((int)(120 * Math.Abs(network.Map_Red_42[i, j])) % 255, 0, 0));
                    greenbmp.SetPixel(i, j, Color.FromArgb(0, (int)(120 * Math.Abs(network.Map_Green_42[i, j])) % 255, 0));
                    bluebmp.SetPixel(i, j, Color.FromArgb(0, 0, (int)(120 * Math.Abs(network.Map_Blue_42[i, j])) % 255));
                }
            }

            pictureBox24.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox26.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox28.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox24.Image    = redbmp;
            pictureBox26.Image    = greenbmp;
            pictureBox28.Image    = bluebmp;
        }