private void button1_Click(object sender, EventArgs e)
        {
            Point point = new Point();

            int index;

            index = listBox1.SelectedIndex;

            sWatch = new Stopwatch();

            switch (index)
            {
            case 0:
                point = Correlator.classicNorm(colorImage, colorModel, imageOrigin, Model.modelImage,
                                               rectSearch, progressBar1, sWatch, label23);
                break;

            case 1:
                point = Correlator.diffAbs(colorImage, colorModel, imageOrigin, Model.modelImage,
                                           rectSearch, progressBar1, sWatch, label23);
                break;

            case 2:
                point = Correlator.diffSqr(colorImage, colorModel, imageOrigin, Model.modelImage,
                                           rectSearch, progressBar1, sWatch, label23);
                break;

            case 3:
                point = Correlator.normCorrilation(colorImage, colorModel, imageOrigin, Model.modelImage,
                                                   rectSearch, progressBar1, sWatch, label23);
                break;

            default:
                MessageBox.Show("Выберете корреляционный алгоритм для поиска");
                break;
            }

            if (index != -1)
            {
                rectFind = new Rectangle(point, Model.modelImage.Size);
                drawImage();
                label20.Text = "X1=" + point.X;
                label19.Text = "Y1=" + point.Y;
                label24.Text = "время = " + (((double)sWatch.ElapsedMilliseconds) / 1000).ToString() + " сек";
                MessageBox.Show("Фрагмент найден");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Point point = new Point();

            int index;

            index = listBox1.SelectedIndex;

            sWatch = new Stopwatch();

            Colors color = new Colors();

            if (radioButton1.Checked)
            {
                color = Colors.RED;
            }
            if (radioButton2.Checked)
            {
                color = Colors.GREEN;
            }
            if (radioButton3.Checked)
            {
                color = Colors.BLUE;
            }

            switch (index)
            {
            case 0:
                point = Correlator.classicNorm(color, color, image4, Model.modelImage,
                                               rectSearch, progressBar1, sWatch, label23);
                break;

            case 1:
                point = Correlator.diffAbs(color, color, image4, Model.modelImage,
                                           rectSearch, progressBar1, sWatch, label23);
                break;

            case 2:
                point = Correlator.diffSqr(color, color, image4, Model.modelImage,
                                           rectSearch, progressBar1, sWatch, label23);
                break;

            case 3:
                point = Correlator.normCorrilation(color, color, image4, Model.modelImage,
                                                   rectSearch, progressBar1, sWatch, label23);
                break;

            default:
                MessageBox.Show("Выберете алгоритм");
                break;
            }

            if (index != -1)
            {
                rectFind = new Rectangle(point, Model.modelImage.Size);

                pointWithOut = new MyPoint(((double)(2 * point.X + Model.modelImage.Width)) / 2d,
                                           ((double)(2 * point.Y + Model.modelImage.Height)) / 2d);

                points4.Clear();
                points4.Add(new Point((int)Math.Round(pointWithOut.x), (int)Math.Round(pointWithOut.y)));
                label31.Text = "X k0=" + pointWithOut.x.ToString();
                label28.Text = "Y k0=" + pointWithOut.y.ToString();

                MyPoint myPoint = new MyPoint();
                if (index == 0 || index == 3)
                {
                    myPoint = Correlator.getPointSubShiftMax();
                }
                if (index == 1 || index == 2)
                {
                    myPoint = Correlator.getPointSubShiftMin();
                }
                correctedSignMyPointdXdY(myPoint);
                label37.Text = "dx=" + myPoint.x.ToString();
                label36.Text = "dy=" + myPoint.y.ToString();

                MyPoint pointWithSub = new MyPoint(pointWithOut.x + myPoint.x, pointWithOut.y + myPoint.y);
                label34.Text = "X k=" + pointWithSub.x.ToString();
                label33.Text = "Y k=" + pointWithSub.y.ToString();
                k            = new MyPoint(pointWithSub.x, pointWithSub.y); //сохранение k

                drawImage2();
                label20.Text = "X1=" + point.X;
                label19.Text = "Y1=" + point.Y;
                label24.Text = "time = " + (((double)sWatch.ElapsedMilliseconds) / 1000).ToString() + " sec";
                MessageBox.Show("Прямоугольная область найдена");
            }

            button2.Enabled = true;
        }