public void SetUp() { _testClass = new DefaultDiffAlgorithm <ArgbPixelDelta, EmptyProcessor>(); _progressObserver = new Mock <IDiffProgressObserver>().Object; leftImg3 = Image.FromFile(Path.Combine("Samples", "Sample_3_A.jpg")) as Bitmap; rightImg3 = Image.FromFile(Path.Combine("Samples", "Sample_3_B.jpg")) as Bitmap; }
public void Highlight(Image target, IPixelBuffer pixels, int limit, IDiffProgressObserver progress = null) { using var g = Graphics.FromImage(target); foreach (var cluster in _clusteringAlgorithm.GetClusters(pixels, limit)) { g.DrawRectangle(_pen, cluster); if (progress == null) { continue; } using var report = new ReportBuilder(target).AddRectangle(cluster, _pen).Build(); progress.Report(report, "rect"); } }
private ImgDiffCalculator(ImgDiffOptions options) { _leftPath = options.LeftFile; _rightPath = options.RightFile; _left = Image.FromFile(_leftPath) as Bitmap; _right = Image.FromFile(_rightPath) as Bitmap; if (_left == null || _right == null) { throw new NotSupportedException("Image format not supported!"); } if (_left.Size != _right.Size) { throw new NotSupportedException("Different image sizes are not supported!"); } _diffAlgorithm = options.DiffAlgorithm; _diffHighlighter = options.Highlighter; _progressObserver = options.ProgressObserver; }
public void SetUp() { _testClass = new RectangleDiffHighlighter(); _progressObserver = new Mock <IDiffProgressObserver>().Object; }
public void SetUp() { _progressObserver = new Mock <IDiffProgressObserver>().Object; }
public async Task <IPixelBuffer> GetDifferentPixelsAsync(double errorTolerance, BitmapData left, BitmapData right, IDiffProgressObserver progress = null) { var result = GenerateDiffMap(errorTolerance, left, right); if (progress == null) { return(result); } using var report = new ReportBuilder(left.Width, left.Height).AddPixels(result, Color.Red).Build(); await progress.ReportAsync(report, "diffMap"); return(result); }