Table of Contents

Class CompareOptions

Namespace
Egami.Analysis
Assembly
Egami.dll
public sealed record CompareOptions : IEquatable<CompareOptions>
Inheritance
CompareOptions
Implements
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 how alpha is treated. Defaults to Premultiplied.

public AlphaCompare Alpha { get; init; }

Property Value

AlphaCompare

Exceptions

ArgumentOutOfRangeException

The value is not defined.

Butteraugli

Gets whether the Butteraugli distance is computed too (Butteraugli and Butteraugli3Norm). It models the eye and costs far more than SSIM, so it is off by default and both are NaN.

public bool Butteraugli { get; init; }

Property Value

bool

Default

Gets the default options: premultiplied alpha, no fuzz, no SSIM or Butteraugli, the whole first frame.

public static CompareOptions Default { get; }

Property Value

CompareOptions

Frame

Gets the frame compared, 0 (the default) for the first.

public int Frame { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is negative.

Fuzz

Gets how far a channel may differ, from 0 to 1, before its pixel counts in DifferentPixels: ImageMagick's AE metric with -fuzz. Defaults to 0, so any difference counts.

public float Fuzz { get; init; }

Property Value

float

Exceptions

ArgumentOutOfRangeException

The value is outside 0 to 1.

Region

Gets the rectangle compared, or null (the default) for the whole image.

public Rect? Region { get; init; }

Property Value

Rect?

Ssim

Gets whether SSIM and DSSIM are computed too. They cost about as much as four blurs, so they are off by default and Ssim is NaN.

public bool Ssim { get; init; }

Property Value

bool