public void Process(Settings settings) { var imagesPath = settings.ImagesPath; var images = _fileInputOutputHelper.ReadImages(imagesPath, FileType.jpg); var options = new ParallelOptions { MaxDegreeOfParallelism = 16 }; Parallel.ForEach(images, options, (imageContext) => { ProcessSingleImage(imageContext, settings); _fileInputOutputHelper.SaveImage(imageContext); imageContext.Dispose(); }); }
public void Process(Settings settings) { var imagesPath = settings.ImagesPath; var context = new ImageProcessingContext(); var images = _fileInputOutputHelper.ReadImages(imagesPath, FileType.jpg); foreach (var image in images) { _bitmapConverter.ApplyGrayScale(image); //So far gaussian is too slow //_bitmapConverter.ApplyGaussianBlur(image, settings); _fileInputOutputHelper.SaveImage(image, true); } }
public void GetLicensesHistogramAverages(string path) { var images = _fileInputOutputHelper.ReadImages(path, FileType.png); var avgByImage = _licensePlateAreaValidator.GetHistogramAverages(images).ToList(); var avgs = avgByImage.Select(x => x.Averages).Where(x => x[0] > 0 && x[1] > 0).ToList(); var lowestSatAvg = avgs.Min(x => x[0]); var meanSatAvg = avgs.Average(x => x[0]); var highestSatAvg = avgs.Max(x => x[0]); var lowestValueAvg = avgs.Min(x => x[1]); var meanValueAvg = avgs.Average(x => x[1]); var highestValueAvg = avgs.Max(x => x[1]); foreach (var image in avgByImage) { _fileInputOutputHelper.SaveImage(image.Image); } }