C22 · Store and compare
Quality, errors and verification
One score cannot answer every question. First define error and what constitutes a valid reference.
Background if needed
Theory
A metric begins with a fair comparison
MSE averages squared pixel errors; RMSE restores the signal's units. PSNR uses a declared peak range, here 1. Zero error gives infinite PSNR, not an arbitrary large number. Coordinates, scales and value domains must agree.
A clean synthetic scene provides a genuine reference. An uploaded photo without a known clean original cannot have an invented PSNR. Filter comparisons should lock disturbance, boundaries and parameters; otherwise input changes are mistaken for method differences.
An average hides where damage occurs
Adding a to all 256 pixels gives . Adding 4a only to a 4×4 patch gives . The scores match, yet one shifts the whole image while the other severely damages a small region. A residual map and profile reveal the difference.
SSIM compares local structure under a chosen window and is not a universal judge. IoU and Dice suit masks, but a missing thin channel may need boundary or topology assessment. Learned perceptual metrics depend on a trained model and may disagree with the task or a human.
Same MSE, different damage
On the left every pixel receives a; on the right only a 4×4 patch receives 4a. Select inside the patch, then outside it: the line and profile reveal the difference hidden by the average score.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The image line marks this same row. Select a higher or lower point to move the cross-section; compare values at the same column.
- Reference
- Everywhere +a
- Patch +4a
- Selected column: 3
Relocating error can preserve MSE and PSNR while changing what is damaged. Inspect the residual map, not just the number.
- MSE
- 0.01
- RMSE
- 0.1
- PSNR (range 0–1)
- 20 dB
- Uniform-error MSE
- 0.01
- Local-error MSE
- 0.01
Parameters and details
Shifting the whole image by a and a 4×4 patch by 4a gives equal MSE: patch area is 1/16. Visible errors differ. Metrics use unclipped data, a known aligned reference and a declared 0–1 peak range.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
An artifact suggests which assumption failed
Ringing near edges relates to frequency truncation; halos to excess detail boost; blocking to independent block processing; banding to coarse quantization. Stair steps and moiré can arise from undersampling. Different causes need different fixes, not one quality slider.
Verification includes constants, impulses, ramps, frame edges, missing samples and parameter extremes. Iterations need bounded stopping, finite numbers and checks of the claimed objective. Full-size files also need device-specific memory and timing measurements. A repeatable attractive example is evidence, not proof of universal reliability.
Practice
Test the idea under another condition. Follow the task above the images; point inspection helps explain the result. This exploration is not scored.
Check two equal scores
The error is stronger. Compare both MSE values, then inspect a cross-section through the damaged patch and another below it. One row cannot describe the whole image.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The image line marks this same row. Select a higher or lower point to move the cross-section; compare values at the same column.
- Reference
- Everywhere +a
- Patch +4a
- Selected column: 3
Matching curves outside the patch do not imply matching images. Scores, error maps and measurement locations must answer the same task.
- MSE
- 0.04
- RMSE
- 0.2
- PSNR (range 0–1)
- 13.9794 dB
- Uniform-error MSE
- 0.04
- Local-error MSE
- 0.04
Parameters and details
Shifting the whole image by a and a 4×4 patch by 4a gives equal MSE: patch area is 1/16. Visible errors differ. Metrics use unclipped data, a known aligned reference and a declared 0–1 peak range.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Games
Test your explanation
Question 1 of 5
Can true PSNR be measured for an uploaded photo without a clean reference?
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Choose one answer. It is checked immediately.
Limitations and references
Limits of this example
MSE/RMSE/PSNR are computed only against the known synthetic reference. SSIM, perceptual and no-reference metrics are explained, not substituted by MSE.
Mathematical reference
- Numbers, functions and grids
- Probability and statistical models
- Optimization and inverse problems
- Numerical computation