Filter to mark (highlight) points in a image.

The filter highlights points on the image using a given set of points.

The filter accepts 8 bpp grayscale, 24 and 32 bpp color images for processing.

상속: BaseInPlaceFilter
예제 #1
0
        public void FindTest()
        {
            List<IntPoint> contour = new List<IntPoint>();

            int max = 100;

            for (int i = 0; i < max; i++)
                add(contour, i, max);

            for (int i = 0; i < max; i++)
                add(contour, max, i);

            for (int i = 0; i < max; i++)
                add(contour, 0, i);

            for (int i = 0; i < max / 2; i++)
                add(contour, i, i);

            for (int i = 0; i < max / 2; i++)
                add(contour, i + max / 2, max / 2 - i);

            PointsMarker marker = new PointsMarker(contour);
            var bitmap = AForge.Imaging.Image.CreateGrayscaleImage(max + 1, max + 1);
            bitmap = marker.Apply(bitmap);
            // Accord.Controls.ImageBox.Show(bitmap);

            GrahamConvexHull graham = new GrahamConvexHull();
            List<IntPoint> hull = graham.FindHull(contour);
            ConvexHullDefects hullDefects = new ConvexHullDefects(10);
            List<ConvexityDefect> defects = hullDefects.FindDefects(contour, hull);

            Assert.AreEqual(1, defects.Count);
            Assert.AreEqual(99, defects[0].Depth);
        }
예제 #2
0
        public void RansacLineConstructorTest2()
        {
            Accord.Math.Tools.SetupGenerator(0);

            Bitmap image = Resources.noise_line;

            //Accord.Controls.ImageBox.Show(image); 

            var detector = new SusanCornersDetector();

            List<IntPoint> cloud = detector.ProcessImage(image);
            Assert.AreEqual(211, cloud.Count);

            Bitmap marks = new PointsMarker(cloud, Color.Pink).Apply(image);
            //Accord.Controls.ImageBox.Show(marks);

            RansacLine ransac = new RansacLine(5, 1e-10);
            Line line = ransac.Estimate(cloud);

            Assert.AreEqual(0.501134932f, line.Intercept);
            Assert.AreEqual(-0.865369201f, line.Slope);

            //var result = new LineMarker(line).Apply(image);
            //Accord.Controls.ImageBox.Show(result);
        }
예제 #3
0
        private void btnHarris_Click(object sender, EventArgs e)
        {
            // Step 1: Detect feature points using Harris Corners Detector
            HarrisCornersDetector harris = new HarrisCornersDetector(
                HarrisCornerMeasure.Harris, 20000f, 1.4f, 5);
            harrisPoints1 = harris.ProcessImage(img1).ToArray();
            harrisPoints2 = harris.ProcessImage(img2).ToArray();

            // Show the marked points in the original images
            Bitmap img1mark = new PointsMarker(harrisPoints1).Apply(img1);
            Bitmap img2mark = new PointsMarker(harrisPoints2).Apply(img2);

            // Concatenate the two images together in a single image (just to show on screen)
            Concatenate concatenate = new Concatenate(img1mark);
            pictureBox.Image = concatenate.Apply(img2mark);
        }
예제 #4
0
        private void btnFreak_Click(object sender, EventArgs e)
        {
            // Step 1: Detect feature points using FREAK Features Detector
            FastRetinaKeypointDetector freak = new FastRetinaKeypointDetector();

            keyPoints1 = freak.ProcessImage(img1).ToArray();
            keyPoints2 = freak.ProcessImage(img2).ToArray();

            // Show the marked points in the original images
            Bitmap img1mark = new PointsMarker(keyPoints1).Apply(img1);
            Bitmap img2mark = new PointsMarker(keyPoints2).Apply(img2);

            // Concatenate the two images together in a single image (just to show on screen)
            Concatenate concatenate = new Concatenate(img1mark);
            pictureBox.Image = concatenate.Apply(img2mark);
        }
예제 #5
0
        private static void show(Bitmap hand, List<IntPoint> contour, List<IntPoint> peaks, List<IntPoint> supports)
        {
            PointsMarker cmarker = new PointsMarker(contour, Color.White, 1);
            cmarker.ApplyInPlace(hand);

            PointsMarker pmarker = new PointsMarker(peaks, Color.Green, 5);
            pmarker.ApplyInPlace(hand);

            PointsMarker hmarker = new PointsMarker(supports, Color.Yellow, 5);
            hmarker.ApplyInPlace(hand);

            ImageBox.Show(hand, PictureBoxSizeMode.Zoom);
        }
예제 #6
0
        public void RansacLineConstructorTest2()
        {
            Bitmap image = Properties.Resources.noise_line;

            ImageBox.Show(image); 

            var detector = new SusanCornersDetector();

            List<IntPoint> cloud = detector.ProcessImage(image);

            Bitmap marks = new PointsMarker(cloud, Color.Pink).Apply(image);
            ImageBox.Show(marks);

            RansacLine ransac = new RansacLine(5, 1e-10);
            Line line = ransac.Estimate(cloud);

            Bitmap result = new LineMarker(line).Apply(image);
            ImageBox.Show(result);

            Assert.Fail();
        }