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
§Recommended Metrics
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:
| Level | DSSIM | SSIMULACRA2 | Butteraugli | Description |
|---|---|---|---|---|
| Imperceptible | < 0.0003 | > 90 | < 1.0 | Visually identical |
| Marginal | < 0.0007 | > 80 | < 2.0 | Only A/B comparison reveals |
| Subtle | < 0.0015 | > 70 | < 3.0 | Barely noticeable |
| Noticeable | < 0.003 | > 50 | < 5.0 | Visible on inspection |
| Degraded | >= 0.003 | <= 50 | >= 5.0 | Clearly 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§
- Metric
Config - Configuration for which metrics to calculate.
- Metric
Result - Results from metric calculations.
Enums§
- Perception
Level - Perceptual quality level based on metric thresholds.
Functions§
- calculate_
psnr - Calculate PSNR between two images.