예제 #1
0
        } // end of Kirsch

        /// <summary>
        /// 按 GaussLaplacian 算子进行边缘检测
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public Bitmap GaussLaplacian(Bitmap b)
        {
            int[,] kernel =
            {
                { -2, -4, -4, -4, -2 },
                { -4,  0,  8,  0, -4 },
                { -4,  8, 24,  8, -4 },
                { -4,  0,  8,  0, -4 },
                { -2, -4, -4, -4, -2 }
            };

            MatrixNxN m = new MatrixNxN();

            m.Kernel = kernel;

            return(m.Convolute(b));
        } // end of GaussLaplacian
예제 #2
0
        } // end of EdgeDetectHorizontal

        /// <summary>
        /// 按垂直边缘检测算子进行边缘检测
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public Bitmap EdgeDetectVertical(Bitmap b)
        {
            int[,] kernel =
            {
                { 0, 0, -1, 0, 1, 0, 0 },
                { 0, 0, -1, 0, 1, 0, 0 },
                { 0, 0, -1, 0, 1, 0, 0 },
                { 0, 0, -1, 0, 1, 0, 0 },
                { 0, 0, -1, 0, 1, 0, 0 },
                { 0, 0, -1, 0, 1, 0, 0 },
                { 0, 0, -1, 0, 1, 0, 0 },
            };

            MatrixNxN m = new MatrixNxN();

            m.Kernel = kernel;

            return(m.Convolute(b));
        } // end of EdgeDetectVertical
예제 #3
0
        } // end of GaussLaplacian

        /// <summary>
        /// 按水平边缘检测算子进行边缘检测
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public Bitmap EdgeDetectHorizontal(Bitmap b)
        {
            int[,] kernel =
            {
                {  0,  0,  0,  0,  0,  0,  0 },
                {  0,  0,  0,  0,  0,  0,  0 },
                { -1, -1, -1, -1, -1, -1, -1 },
                {  0,  0,  0,  0,  0,  0,  0 },
                {  1,  1,  1,  1,  1,  1,  1 },
                {  0,  0,  0,  0,  0,  0,  0 },
                {  0,  0,  0,  0,  0,  0,  0 },
            };

            MatrixNxN m = new MatrixNxN();

            m.Kernel = kernel;

            return(m.Convolute(b));
        } // end of EdgeDetectHorizontal