void PlotBoxR() { var plotGauss = new PlotModel { Title = $"Box R for {fileInfo.Name}" }; plotGauss.Axes.Add(new LinearAxis { Title = "R", Position = AxisPosition.Bottom }); plotGauss.Axes.Add(new LinearAxis { Title = "PSNR", Position = AxisPosition.Left }); using (var imageLoader = new ImageLoader()) { imageLoader.Load(fileInfo.FullName); Image image = imageLoader.Image; var points = new LineSeries { StrokeThickness = 2, MarkerSize = 4, Color = OxyColors.Red }; for (var R = 1; R <= 8; R++) { //imageLoader.Image = noise; imageLoader.AddNoise(new GaussNoise(new Normal(0, 50))); // 100 dispersy imageLoader.AddBoxFilter(R); double psnr = imageLoader.CalculatePSNR(image); points.Points.Add(new DataPoint(R, psnr)); imageLoader.Image = image; } plotGauss.Series.Add(points); } pngExporter.ExportToFile(plotGauss, $"{outputPath}/{fileInfo.Name}/BoxFilterPlotR.png"); }
private static void BoxFilter(FileInfo file, string outputFileName) { Console.WriteLine("***BOX FILTER***"); if (file == null) { throw new ArgumentNullException(nameof(file)); } using (var imageLoader = new ImageLoader()) { imageLoader.Load(file.FullName); Image image = imageLoader.Image; imageLoader.AddNoise(new GaussNoise(new Normal(0, 0.25))); imageLoader.Save($"{outputFileName}noise{file.Extension}"); Console.WriteLine($"psnr-noise: {imageLoader.CalculatePSNR(image):F2}"); imageLoader.AddBoxFilter(5); imageLoader.Save($"{outputFileName}boxfiltered{file.Extension}"); Console.WriteLine($"psnr-boxfilter: {imageLoader.CalculatePSNR(image):F2}"); } }