Class CompareResult
What Compare(Raster, Raster, CompareOptions?) found: each channel's difference, the overall one, and how many pixels differ.
public sealed class CompareResult
- Inheritance
-
CompareResult
- Inherited Members
Examples
// Every cheap metric in one pass, per channel and overall, on the 0 to 1 scale; SSIM on request.
CompareResult result = Raster.Compare(expected, actual, new CompareOptions { Ssim = true, Fuzz = 0.02f });
Console.WriteLine($"PSNR {result.Overall.Psnr:F1} dB, SSIM {result.Overall.Ssim:F4}, {result.DifferentPixels} pixels off by more than 2%");
bool sameLook = result.Overall.Psnr >= 40;
Properties
Alpha
Gets the alpha channel's difference: zero when neither image has alpha.
public ChannelDifference Alpha { get; }
Property Value
Blue
Gets the blue channel's difference.
public ChannelDifference Blue { get; }
Property Value
Butteraugli
Gets the Butteraugli distance (libjxl's psychovisual metric, as butteraugli_main prints it): the largest difference the model of the eye finds anywhere, where under about 1 the images look the same. NaN unless Butteraugli was set.
public double Butteraugli { get; }
Property Value
Remarks
The color channels are read as sRGB, or as linear light when the image's profile has a linear curve, with sRGB primaries, 1.0 being 80 nits. Images with alpha are compared over black and over white, and the larger distance counts.
Butteraugli3Norm
Gets the Butteraugli 3-norm: the mean of the distance map's 3-, 6- and 12-norms, which follows the overall quality more than the single worst spot does. NaN unless Butteraugli was set.
public double Butteraugli3Norm { get; }
Property Value
DifferentPixels
Gets how many pixels have a channel that differs by more than Fuzz (ImageMagick's AE).
public long DifferentPixels { get; }
Property Value
Green
Gets the green channel's difference.
public ChannelDifference Green { get; }
Property Value
IsIdentical
Gets whether every compared channel of every pixel is equal.
public bool IsIdentical { get; }
Property Value
Overall
Gets the difference over every channel: the mean of the color channels' errors, plus alpha's when either image has alpha, as ImageMagick's "all" line; PeakError is the largest of them.
public ChannelDifference Overall { get; }
Property Value
PixelCount
Gets how many pixels were compared.
public long PixelCount { get; }
Property Value
Red
Gets the red channel's difference (premultiplied by alpha unless Straight).
public ChannelDifference Red { get; }