using (var newScreenshot = new MagickImage(newScreenshotPath))
{
var snapshotImage = TryGetBaselineImage(snapshotFilePath);
if (snapshotImage == null) return false;
using (snapshotImage)
{
var result = newScreenshot.Equals(snapshotImage);
if (result) return true;
using (var diffImage = new MagickImage())
{
newScreenshot.Compare(snapshotImage, ErrorMetric.Absolute, diffImage);
//I also tried fuzz(10) but with no luck
diffImage.Write(diffImagePath);
}
return false;
}
}
newScreenshot file:
snapshotImage file:
diffImage file:
My problem:
As we can see, at the bottom of diffImage:
Those text wordings get a lot of noise and recognized as different.
But from newScreenshot image and snapshotImage image, we can see that those wordings styles are just the same from a person's viewpoint:
Wondering is there a way to pre-process 2 images or change a way of comparison, that can get a result of SAME?
diffImage tells you the difference is mostly vertical. Looking closely at the two inputs, we see there is a small (less than one pixel) displacement between the images. A small vertical blur eg -morphology Convolve Blur:0x1,90" smooths over that difference.
diffImage tells you where differences are, but doesn't tell you how much the difference is, either overall or the worst differences. The metrics (ie the numbers, eg "-metric RMSE" or "-metric PAE") will do that.