/// <summary> /// Sobel emboss function /// </summary> /// <param name="Image">Image to manipulate</param> /// <returns>A bitmap image</returns> public static Bitmap SobelEmboss(Bitmap Image) { Filter TempFilter = new Filter(3, 3); TempFilter.MyFilter[0, 0] = -1; TempFilter.MyFilter[0, 1] = 0; TempFilter.MyFilter[0, 2] = 1; TempFilter.MyFilter[1, 0] = -2; TempFilter.MyFilter[1, 1] = 0; TempFilter.MyFilter[1, 2] = 2; TempFilter.MyFilter[2, 0] = -1; TempFilter.MyFilter[2, 1] = 0; TempFilter.MyFilter[2, 2] = 1; TempFilter.Offset = 127; return TempFilter.ApplyFilter(Image); }
/// <summary> /// Does smoothing using a box blur /// </summary> /// <param name="Image">Image to manipulate</param> /// <param name="Size">Size of the aperture</param> public static Bitmap BoxBlur(Bitmap Image, int Size) { Filter TempFilter = new Filter(Size, Size); for (int x = 0; x < Size; ++x) { for (int y = 0; y < Size; ++y) { TempFilter.MyFilter[x, y] = 1; } } return TempFilter.ApplyFilter(Image); }
/// <summary> /// Sharpen focus function /// </summary> /// <param name="Image">Image to manipulate</param> /// <returns>A bitmap image</returns> public static Bitmap SharpenLess(Bitmap Image) { Filter TempFilter = new Filter(3, 3); TempFilter.MyFilter[0, 0] = -1; TempFilter.MyFilter[0, 1] = 0; TempFilter.MyFilter[0, 2] = -1; TempFilter.MyFilter[1, 0] = 0; TempFilter.MyFilter[1, 1] = 7; TempFilter.MyFilter[1, 2] = 0; TempFilter.MyFilter[2, 0] = -1; TempFilter.MyFilter[2, 1] = 0; TempFilter.MyFilter[2, 2] = -1; return TempFilter.ApplyFilter(Image); }