All scoring happens entirely in your browser using JavaScript. No server computation is required.
The algorithm analyzes the image's frequency spectrum to measure how "natural" it appears.
1. Spectral Analysis
The image is converted to the frequency domain using a 2D Fast Fourier Transform (FFT). This reveals
how energy is distributed across different spatial frequencies. Natural images typically follow a
1/fα power law, where α ≈ 2-3.
2. Alpha Estimation
We compute a radial profile of the power spectrum and fit a line to estimate the exponent α. Images
closer to our target (α = 3.0) score higher, as they match the statistical properties of natural scenes.
3. Peakiness Penalty
Periodic patterns like checkerboards create sharp peaks in the frequency spectrum. We penalize these
"peaky" patterns, as they're too structured to appear natural.
4. Flatness Penalty
White noise has an unusually flat spectrum (all frequencies have equal power). We detect and penalize
this flatness, distinguishing noise from structured natural patterns.
5. Spatial Correlation
Natural images have high correlation between neighboring pixels. We measure this correlation and
penalize images with low correlation (indicating pure noise).
Final Score: The total score combines all these factors. Higher scores indicate
images that better match the statistical properties of natural photographs.