Median Filtering
Detects whether an image was processed with a median filter, often applied to remove noise or erase the traces of a manipulation. A median filter outputs an existing pixel value rather than a new average, leaving a streaking artefact where adjacent pixels take identical values far more often than in a natural image.
Technical description
Measures the identical-neighbour ratio, the fraction of interior pixels equal to one of their four neighbours, as the median-specific streaking signal: a ratio above 0.15 scores min(2.5, 20*(ratio - 0.15)). It also measures the lag-1 autocorrelation (mean Pearson correlation of horizontally and vertically adjacent pixels), but scores it only as corroboration, min(2.5, 5*(autocorr - 0.5)) when autocorr > 0.5 AND the streaking ratio exceeds 0.15, because autocorrelation is raised by any smoothing, not by median filtering specifically. The two contributions sum to a maximum of 5.0.
How it works
Layer 1 (deterministic): checks for every interior pixel whether it equals any of its four neighbours and takes the fraction as the identical-neighbour ratio (the median streaking signature); a ratio above 0.15 contributes the primary score. The lag-1 autocorrelation contributes a corroborating score only when it exceeds 0.5 and the streaking ratio is also raised, so a genuinely smooth or blurred image is not misread as median-filtered. The contributions are summed and capped at 5.0.
Why this matters
Median filtering is a favourite of manipulators because it suppresses the noise inconsistencies, resampling periodicity, and compression history that other detectors rely on, so detecting the median filter itself recovers evidence that an image was scrubbed. Its defining artefact is value-preserving streaking: because the median selects an existing neighbourhood value rather than averaging, the output contains runs of identical pixels that linear smoothing does not produce, raising the identical-neighbour ratio well above the natural chance level.
Score thresholds
- 0-1
- The identical-neighbour ratio is near the natural chance level, no median-filtering trace
- 2-3
- A raised identical-neighbour ratio, indicating likely median filtering
- 4-5
- A strongly raised identical-neighbour ratio corroborated by high adjacent-pixel correlation, consistent with median filtering
Limitations
The identical-neighbour ratio is median-specific in principle but not perfectly exclusive: heavy blur followed by quantisation, downscaling, or a low-bit-depth source can also raise the number of repeated adjacent values, so on already-smooth or low-entropy content median filtering cannot be fully separated from other smoothing. The screen is most reliable on natural, full-entropy images. The autocorrelation gating may miss a very light median filter that barely streaks. The screen returns a single global verdict and does not localize the region or estimate the kernel. Resampling traces are indicator M9 and compression history is the JPEG-ghost indicator I7; M10 stays on the median-filter streaking signature.
References
- Bovik AC. (1987). Streaking in median filtered images. IEEE Transactions on Acoustics, Speech, and Signal Processing 35(4):493-503
- Kirchner M, Fridrich J. (2010). On detection of median filtering in digital images. Proceedings of SPIE 7541, Media Forensics and Security II:754110
- Cao G, Zhao Y, Ni R, Yu L, Tian H. (2010). Forensic detection of median filtering in digital images. Proceedings of the 2010 IEEE International Conference on Multimedia and Expo (ICME):89-94