예제 #1
0
        private void FindPointButton_Click(object sender, EventArgs e)
        {
            MinValueHarris = Convert.ToDouble(txb_minValue.Text);
            WindowSize     = Convert.ToInt32(txb_WindowSize.Text);
            int maxPoints;
            int gridSize  = Convert.ToInt32(txb_gridSize.Text);
            int cellSize  = Convert.ToInt32(txb_cellSize.Text);
            int binsCount = Convert.ToInt32(txb_binsCount.Text);

            if (filter_checkBox.Checked == true)
            {
                maxPoints = Convert.ToInt32(txb_Filter.Text);
            }
            else
            {
                maxPoints = 5000;
            }

            List <InterestingPoint> pointsA =
                NonMaximumSuppression.FilterA(imageA, Harris.DoHarris(MinValueHarris, WindowSize, imageA), maxPoints);
            List <InterestingPoint> pointsB =
                NonMaximumSuppression.FilterA(imageB, Harris.DoHarris(MinValueHarris, WindowSize, imageB), maxPoints);

            List <ForDescriptor.Descriptor> descriptorsA = RotationInvariant.Calculate(imageA, pointsA);
            List <ForDescriptor.Descriptor> descriptorsB = RotationInvariant.Calculate(imageB, pointsB);

            List <ValueTuple <ForDescriptor.Descriptor, ForDescriptor.Descriptor> > match;

            if (rbt_usual.Checked == true)
            {
                match = DescriptorMatcher.Match(descriptorsA, descriptorsB);
            }
            else if (rbt_NNDR.Checked == true)
            {
                match = DescriptorMatcher.Nndr(descriptorsA, descriptorsB);
            }
            else
            {
                match = DescriptorMatcher.Match(descriptorsA, descriptorsB);
            }

            lbl_findPoints1.Text = "Найдено интересных точек(1): " + pointsA.Count;
            lbl_findPoints2.Text = "Найдено интересных точек(2): " + pointsB.Count;
            lbl_PairCount.Text   = "Найдено пар точек: " + match.Count;

            var image = DrawHelper.DrawTwoImages(
                DrawHelper.DrawPoints(imageA, pointsA), DrawHelper.DrawPoints(imageB, pointsB), match);

            IOHelper.WriteImageToFile(image, "..\\..\\..\\..\\Output\\OutputPicture.png");

            pictureBox1.Image = image;
        }
        private void FindPointButton_Click(object sender, EventArgs e)
        {
            if (RB_DoMoravec.Checked == true)
            {
                double minValue     = Convert.ToDouble(textBox1.Text);
                int    windowSize   = Convert.ToInt32(textBox2.Text);
                int    shiftSize    = Convert.ToInt32(textBox3.Text);
                int    locMaxRadius = Convert.ToInt32(textBox4.Text);

                List <InterestingPoint> MoravecMatrix = Moravec.DoMoravec(minValue, windowSize, shiftSize, locMaxRadius, _image);

                if (filter_checkBox.Checked == true)
                {
                    int maxCountPoints = Convert.ToInt32(textBox7.Text);
                    List <InterestingPoint> subList = NonMaximumSuppression.FilterA(_image, MoravecMatrix, maxCountPoints); // Фильтр точек
                    label9.Text  = "Найдено интересных точек: " + MoravecMatrix.Count;
                    label10.Text = "Отображенно интересных точек: " + subList.Count;
                    DrawPoints(subList);
                }
                else
                {
                    label10.Text = "Отображенно интересных точек: " + MoravecMatrix.Count;
                    label9.Text  = "Найдено интересных точек: " + MoravecMatrix.Count;
                    DrawPoints(MoravecMatrix);
                }
            }

            if (RB_DoHarris.Checked == true)
            {
                double minValue   = Convert.ToDouble(textBox5.Text);
                int    windowSize = Convert.ToInt32(textBox6.Text);
                List <InterestingPoint> HarrisMatrix = Harris.DoHarris(minValue, windowSize, _image);

                ///////////
                #region Отклик кнопок
                if (checkBox2.Checked == true)
                {
                    List <InterestingPoint> SubHarrisMatrix = Harris.DoHarris(minValue, windowSize, _image);
                    label9.Text = "Найдено откликов: " + SubHarrisMatrix.Count;
                    DrawMap(SubHarrisMatrix, _image);
                }
                else
                if (checkBox1.Checked == true)
                {
                    List <InterestingPoint> SubHarrisMatrix = Harris.DoHarris(minValue, windowSize, _image);
                    DrawMap(SubHarrisMatrix, _image);
                    label9.Text = "Найдено локальных максимумов: " + SubHarrisMatrix.Count;
                }

                else if (filter_checkBox.Checked == true)
                {
                    int maxCountPoints = Convert.ToInt32(textBox7.Text);
                    List <InterestingPoint> subList = NonMaximumSuppression.FilterB(
                        HarrisMatrix,
                        maxCountPoints
                        ); // Фильтр точек
                    DrawPoints(subList);
                    label9.Text  = "Найдено интересных точек: " + HarrisMatrix.Count;
                    label10.Text = "Отображенно интересных точек: " + subList.Count;
                }
                else
                {
                    label10.Text = "Отображенно интересных точек: " + HarrisMatrix.Count;
                    label9.Text  = "Найдено интересных точек: " + HarrisMatrix.Count;
                    DrawPoints(HarrisMatrix);
                }

                #endregion
            }
        }