public void highBoost(int maskSize, double sigma, double k)
        {
            // k==1 Unsharp
            // k>1 highboost
            Bitmap original = new Bitmap(Img);

            gaussianFilter(maskSize, sigma);
            Bitmap MaskImage = ImageArithmetic.Subtract(original, Img);
            Bitmap newImg    = new Bitmap(Img.Width, Img.Height);

            for (int col = 0; col < Img.Width; col++)
            {
                for (int row = 0; row < Img.Height; row++)
                {
                    Color curCol  = Img.GetPixel(col, row);
                    Color maskCol = MaskImage.GetPixel(col, row);
                    int   newR    = (int)(curCol.R + k * maskCol.R);
                    int   newG    = (int)(curCol.G + k * maskCol.G);
                    int   newB    = (int)(curCol.B + k * maskCol.B);

                    newR = Math.Min(newR, 255);
                    newR = Math.Max(newR, 0);
                    newG = Math.Min(newG, 255);
                    newG = Math.Max(newG, 0);
                    newB = Math.Min(newB, 255);
                    newB = Math.Max(newB, 0);
                    newImg.SetPixel(col, row, Color.FromArgb(newR, newG, newB));
                }
            }
            this.Img = newImg;
        }
 public ImageFilter(Bitmap Img)
 {
     if (Img.PixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb && Img.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb)
     {
         this.Img = ImageArithmetic.toGray(Img);
     }
     else
     {
         this.Img = Img;
     }
 }