Skip to main content

Module metrics

Module metrics 

Source
Expand description

Quality metrics for image comparison.

This module provides perceptual quality metrics for comparing reference and test images. Supported metrics:

  • DSSIM: Structural dissimilarity metric (lower is better, 0 = identical)
  • SSIMULACRA2: Perceptual similarity metric (higher is better, 100 = identical)
  • Butteraugli: Perceptual difference metric (lower is better, <1.0 = imperceptible)
  • PSNR: Peak Signal-to-Noise Ratio (higher is better) - NOT RECOMMENDED

Prefer SSIMULACRA2 or Butteraugli over PSNR. PSNR does not correlate well with human perception. SSIMULACRA2 and Butteraugli are designed to match human visual perception of image quality.

§Perception Thresholds

Based on empirical data from imageflow:

LevelDSSIMSSIMULACRA2ButteraugliDescription
Imperceptible< 0.0003> 90< 1.0Visually identical
Marginal< 0.0007> 80< 2.0Only A/B comparison reveals
Subtle< 0.0015> 70< 3.0Barely noticeable
Noticeable< 0.003> 50< 5.0Visible on inspection
Degraded>= 0.003<= 50>= 5.0Clearly visible artifacts

Re-exports§

pub use icc::ColorProfile;
pub use icc::prepare_for_comparison;
pub use icc::transform_to_srgb;
pub use xyb::xyb_roundtrip;

Modules§

butteraugli
Butteraugli metric calculation.
dssim
DSSIM (Structural Dissimilarity) metric calculation.
icc
ICC color profile handling for accurate metric calculation.
prelude
Re-exports of metric crate types for convenience.
ssimulacra2
SSIMULACRA2 metric calculation.
xyb
XYB color space roundtrip for fair metric comparison.

Structs§

MetricConfig
Configuration for which metrics to calculate.
MetricResult
Results from metric calculations.

Enums§

PerceptionLevel
Perceptual quality level based on metric thresholds.

Functions§

calculate_psnr
Calculate PSNR between two images.