Пример #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;
        }
Пример #2
0
        public static List <Descriptor> FindBlobs(Mat image, int pointCount)
        {
            var pyramid = Pyramid.Build(image, OctaveSize, InitSigma, StartSigma);
            var points  = NonMaximumSuppression.FilterA(image, FindPoints(pyramid), pointCount);

            var descriptors = new List <Descriptor>();

            for (var octave = 0; octave < Pyramid.Depth; octave++)
            {
                var firstImage = pyramid.GetLayer(octave, 0);

                var curPoints = points.Where(x => x.Octave == octave).ToList();

                // Сделать вывод точек на картинке
                //   IOHelper.WriteImageToFile(DrawHelper.DrawPoints(pyramid.GetDoG(octave, 2), curPoints), "..\\..\\..\\..\\Output\\" + octave + ".png");

                descriptors.AddRange(RotationInvariant.Calculate(firstImage, curPoints));
            }

            return(descriptors);
        }