Kirsch's Edge Detector

The Kirsch operator or Kirsch compass kernel is a non-linear edge detector that finds the maximum edge strength in a few predetermined directions. It is named after the computer scientist Russell A. Kirsch.

References: Wikipedia contributors. "Kirsch operator." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia. Available at http://en.wikipedia.org/wiki/Kirsch_operator

Inheritance: BaseFilter
        public void ProcessImageTest()
        {
            double[,] diag = Matrix.Magic(5);

            Bitmap input;
            new MatrixToImage().Convert(diag, out input);

            // Create a new Gabor filter
            KirschEdgeDetector filter = new KirschEdgeDetector();

            // Apply the filter
            Bitmap output = filter.Apply(input);

            double[,] actual;

            new ImageToMatrix().Convert(output, out actual);

            // string str = actual.ToString(Accord.Math.Formats.CSharpMatrixFormatProvider.InvariantCulture);

            double[,] expected = 
            {
                { 1, 1, 1, 1, 1 },
                { 1, 0.458823529411765, 0.349019607843137, 0.698039215686274, 1 },
                { 1, 0.309803921568627, 0.658823529411765, 0.286274509803922, 1 },
                { 1, 0.619607843137255, 0.403921568627451, 0.890196078431373, 1 },
                { 1, 1, 1, 1, 0.968627450980392 }  
            };

            Assert.IsTrue(expected.IsEqual(actual, 1e-6));
        }
示例#2
0
        private void SetFilter()
        {
            ImageType = ImageTypes.Rgb24bpp;
            Af.KirschEdgeDetector newFilter = new Af.KirschEdgeDetector();

            imageFilter = newFilter;
        }
        public void ApplyTest1()
        {
            Bitmap image = Properties.Resources.lena512;

            KirschEdgeDetector kirsch = new KirschEdgeDetector();

            Bitmap edges = kirsch.Apply(image);

            // ImageBox.Show(edges);

            Assert.IsNotNull(edges);
        }