public static void SobelX(BMPImage image) { GrayFilter.Gray(image); float[,] kernel = new float[, ] { { -1f, 0f, 1f }, { -2f, 0f, 2f }, { -1f, 0f, 1 } }; UseMatrix(image, kernel); }
public static void Main(string[] args) { Console.WriteLine("This program applies one of the filters to the image."); Console.WriteLine("List of available filters: Gray, Median, Gauss, SobelX, SobelY.\n"); if (args.Length != 3) { Console.WriteLine("Incorrect number of arguments."); return; } BMPImage image = new BMPImage(args[0]); switch (args[1].ToLower()) { case "gray": GrayFilter.Gray(image); break; case "median": MedianFilter.Median(image); break; case "gauss": KernelFilters.Gauss(image); break; case "sobelx": KernelFilters.SobelX(image); break; case "sobely": KernelFilters.SobelY(image); break; default: Console.WriteLine("Unknown filter selected. Available names: Gray, Median, Gauss, SobelX, SobelY."); return; } image.WriteToFile(args[2]); Console.WriteLine("The filter has been appled."); }