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, sobelxy.\n"); if (args.Length != 3) { Console.WriteLine("Incorrect number of command line arguments"); Console.WriteLine("Correct format: <program.exe> <input.bmp> <filtername> <output.bmp>"); return; } BitMapReading input; try { input = new BitMapReading(args[0]); } catch (Exception) { Console.WriteLine("The input file could not be opened"); return; } if (!ChooseFilter.ApplyFilter(input, args[1].ToUpper(), args[2])) { Console.WriteLine("Unknown filter selected"); Console.WriteLine("List of available filters: gray, median, gauss, sobelx, sobely, sobelxy"); } }
public void SobelYFilterTest() { BitMapReading input = new BitMapReading("../../../images/input.bmp"); ChooseFilter.ApplyFilter(input, "SOBELY", "../../../images/testsobely.bmp"); var file1 = new BitMapReading("../../../images/truesobely.bmp"); var file2 = new BitMapReading("../../../images/testsobely.bmp"); Assert.IsTrue(file1 == file2); }
public void GrayFilterTest() { BitMapReading input = new BitMapReading("../../../images/input.bmp"); ChooseFilter.ApplyFilter(input, "GRAY", "../../../images/testgray.bmp"); var file1 = new BitMapReading("../../../images/truegray.bmp"); var file2 = new BitMapReading("../../../images/testgray.bmp"); Assert.IsTrue(file1 == file2); }
public void MedianFilterTest() { BitMapReading input = new BitMapReading("../../../images/input.bmp"); ChooseFilter.ApplyFilter(input, "MEDIAN", "../../../images/testmedian.bmp"); var file1 = new BitMapReading("../../../images/truemedian.bmp"); var file2 = new BitMapReading("../../../images/testmedian.bmp"); Assert.IsTrue(file1 == file2); }