Exemplo n.º 1
0
        /// <summary>
        ///     blur the image
        /// </summary>
        /// <param name="img">
        ///     image to manipulate
        /// </param>
        /// <param name="weight">
        ///     weight of effect
        /// </param>
        public static void Blur(ref ImageData img, double weight)
        {
            ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);

            cMatrix.SetAll(1);
            cMatrix.Matrix[1, 1] = weight;
            cMatrix.Factor       = weight + 8;
            ApplyConvolution3X3(ref img, cMatrix);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     remove mean of image
        /// </summary>
        /// <param name="img">
        ///     image to manipulate
        /// </param>
        /// <param name="weight">
        ///     weight of effect
        /// </param>
        public static void RemoveMean(ref ImageData img, double weight)
        {
            ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);

            cMatrix.SetAll(1);
            cMatrix.Matrix[0, 0] = -1;
            cMatrix.Matrix[1, 0] = -1;
            cMatrix.Matrix[2, 0] = -1;
            cMatrix.Matrix[0, 1] = -1;
            cMatrix.Matrix[1, 1] = weight;
            cMatrix.Matrix[2, 1] = -1;
            cMatrix.Matrix[0, 2] = -1;
            cMatrix.Matrix[1, 2] = -1;
            cMatrix.Matrix[2, 2] = -1;
            cMatrix.Factor       = weight - 8;
            ApplyConvolution3X3(ref img, cMatrix);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     apply gaussianblur to image
        /// </summary>
        /// <param name="img">
        ///     image to manipulate
        /// </param>
        /// <param name="peakValue">
        ///     parameter
        /// </param>
        public static void GaussianBlur(ref ImageData img, double peakValue)
        {
            ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);

            cMatrix.SetAll(1);
            cMatrix.Matrix[0, 0] = peakValue / 4;
            cMatrix.Matrix[1, 0] = peakValue / 2;
            cMatrix.Matrix[2, 0] = peakValue / 4;
            cMatrix.Matrix[0, 1] = peakValue / 2;
            cMatrix.Matrix[1, 1] = peakValue;
            cMatrix.Matrix[2, 1] = peakValue / 2;
            cMatrix.Matrix[0, 2] = peakValue / 4;
            cMatrix.Matrix[1, 2] = peakValue / 2;
            cMatrix.Matrix[2, 2] = peakValue / 4;
            cMatrix.Factor       = peakValue * 4;
            ApplyConvolution3X3(ref img, cMatrix);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     apply emboss effect on image
        /// </summary>
        /// <param name="img">
        ///     image to manipulate
        /// </param>
        /// <param name="weight">
        ///     weight of emboss effect
        /// </param>
        public static void Emboss(ref ImageData img, double weight)
        {
            ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);

            cMatrix.SetAll(1);
            cMatrix.Matrix[0, 0] = -1;
            cMatrix.Matrix[1, 0] = 0;
            cMatrix.Matrix[2, 0] = -1;
            cMatrix.Matrix[0, 1] = 0;
            cMatrix.Matrix[1, 1] = weight;
            cMatrix.Matrix[2, 1] = 0;
            cMatrix.Matrix[0, 2] = -1;
            cMatrix.Matrix[1, 2] = 0;
            cMatrix.Matrix[2, 2] = -1;
            cMatrix.Factor       = 4;
            cMatrix.Offset       = 127;
            ApplyConvolution3X3(ref img, cMatrix);
        }
Exemplo n.º 5
0
 /// <summary>
 ///     blur the image
 /// </summary>
 /// <param name="img">
 ///     image to manipulate
 /// </param>
 /// <param name="weight">
 ///     weight of effect
 /// </param>
 public static void Blur(ref ImageData img, double weight)
 {
     ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);
     cMatrix.SetAll(1);
     cMatrix.Matrix[1, 1] = weight;
     cMatrix.Factor = weight + 8;
     ApplyConvolution3X3(ref img, cMatrix);
 }
Exemplo n.º 6
0
 /// <summary>
 ///     sharpen an image
 /// </summary>
 /// <param name="img">
 ///     image to manipulate
 /// </param>
 /// <param name="weight">
 ///     weight
 /// </param>
 public static void Sharpen(ref ImageData img, double weight)
 {
     ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);
     cMatrix.SetAll(1);
     cMatrix.Matrix[0, 0] = 0;
     cMatrix.Matrix[1, 0] = -2;
     cMatrix.Matrix[2, 0] = 0;
     cMatrix.Matrix[0, 1] = -2;
     cMatrix.Matrix[1, 1] = weight;
     cMatrix.Matrix[2, 1] = -2;
     cMatrix.Matrix[0, 2] = 0;
     cMatrix.Matrix[1, 2] = -2;
     cMatrix.Matrix[2, 2] = 0;
     cMatrix.Factor = weight - 8;
     ApplyConvolution3X3(ref img, cMatrix);
 }
Exemplo n.º 7
0
 /// <summary>
 ///     apply gaussianblur to image
 /// </summary>
 /// <param name="img">
 ///     image to manipulate
 /// </param>
 /// <param name="peakValue">
 ///     parameter
 /// </param>
 public static void GaussianBlur(ref ImageData img, double peakValue)
 {
     ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);
     cMatrix.SetAll(1);
     cMatrix.Matrix[0, 0] = peakValue / 4;
     cMatrix.Matrix[1, 0] = peakValue / 2;
     cMatrix.Matrix[2, 0] = peakValue / 4;
     cMatrix.Matrix[0, 1] = peakValue / 2;
     cMatrix.Matrix[1, 1] = peakValue;
     cMatrix.Matrix[2, 1] = peakValue / 2;
     cMatrix.Matrix[0, 2] = peakValue / 4;
     cMatrix.Matrix[1, 2] = peakValue / 2;
     cMatrix.Matrix[2, 2] = peakValue / 4;
     cMatrix.Factor = peakValue * 4;
     ApplyConvolution3X3(ref img, cMatrix);
 }
Exemplo n.º 8
0
 /// <summary>
 ///     apply emboss effect on image
 /// </summary>
 /// <param name="img">
 ///     image to manipulate
 /// </param>
 /// <param name="weight">
 ///     weight of emboss effect
 /// </param>
 public static void Emboss(ref ImageData img, double weight)
 {
     ConvolutionMatrix cMatrix = new ConvolutionMatrix(3);
     cMatrix.SetAll(1);
     cMatrix.Matrix[0, 0] = -1;
     cMatrix.Matrix[1, 0] = 0;
     cMatrix.Matrix[2, 0] = -1;
     cMatrix.Matrix[0, 1] = 0;
     cMatrix.Matrix[1, 1] = weight;
     cMatrix.Matrix[2, 1] = 0;
     cMatrix.Matrix[0, 2] = -1;
     cMatrix.Matrix[1, 2] = 0;
     cMatrix.Matrix[2, 2] = -1;
     cMatrix.Factor = 4;
     cMatrix.Offset = 127;
     ApplyConvolution3X3(ref img, cMatrix);
 }