Пример #1
0
        /// <summary>
        /// Applies Sobel filter to the image.
        /// </summary>
        /// <param name="image">The image to modify.</param>
        /// <returns>Returns the edge map of the image.</returns>
        public static Bitmap ApplySobelFilter(this ImageFilter imageFilter, Bitmap image)
        {
            var memory = CreateSimpleMemory(
                image,
                1, 2, 1,
                0, 0, 0,
                -1, -2, -1);

            imageFilter.FilterImage(memory);
            return(CreateImage(memory, image));
        }
Пример #2
0
        /// <summary>
        /// Applies a vertical edge detection filter to the image.
        /// </summary>
        /// <param name="image">The image to modify.</param>
        /// <returns>Returns the edge map of the image containing only vertical edges.</returns>
        public static Bitmap DetectVerticalEdges(this ImageFilter imageFilter, Bitmap image)
        {
            var memory = CreateSimpleMemory(
                image,
                1, 0, -1,
                1, 0, -1,
                1, 0, -1);

            imageFilter.FilterImage(memory);
            return(CreateImage(memory, image));
        }
Пример #3
0
        /// <summary>
        /// Applies Gauss filter to an image.
        /// </summary>
        /// <param name="image">The image to modify.</param>
        /// <returns>Returns the smoothed image.</returns>
        public static Bitmap ApplyGaussFilter(this ImageFilter imageFilter, Bitmap image)
        {
            var memory = CreateSimpleMemory(
                image,
                1, 2, 1,
                2, 4, 2,
                1, 2, 1,
                16);

            imageFilter.FilterImage(memory);
            return(CreateImage(memory, image));
        }