I-222Adaptive Histogram Equalization Trace

Pixel Analysisimage2012

Detects traces of CLAHE (Contrast Limited Adaptive Histogram Equalization) applied to mask AI generation artifacts. Real photographs exhibit natural luminance distributions, while AI-generated images processed with CLAHE reveal telltale local contrast enhancement patterns.

CLAHE Residual Detection + Local Contrast Deviation Mapping
The algorithm divides the image into small contextual tiles (typically 8×8 pixels) and computes local histograms for each tile. In authentic photographs, the local contrast transitions between tiles follow smooth, physically motivated gradients dictated by real-world lighting. CLAHE processing, however, clips histogram peaks at a predefined contrast limit and redistributes the clipped pixels uniformly — this creates a characteristic 'staircasing' artifact in the tile boundary transitions.The detector computes: (1) the local contrast ratio between adjacent tiles, (2) the histogram clipping residual by comparing observed vs. theoretical Rayleigh-distributed local histograms, and (3) the inter-tile transition energy using a Sobel gradient at tile boundaries. A weighted anomaly score is produced from these three signals — high scores indicate artificial local contrast manipulation consistent with CLAHE post-processing.
Tile size: 8×8 pixels (default CLAHE grid)
Contrast limit threshold: 2.0–4.0 (clip factor)

Histogram bins: 256

Boundary gradient kernel: Sobel 3×3

Scoring: weighted sum of clipping residual + boundary energy + distribution divergence
Moderate — 65-78% standalone accuracy. Most effective when the CLAHE clip limit is aggressive (>3.0); subtle enhancements with low clip factors are harder to detect.
• Targets a specific, well-understood image processing operation with known mathematical properties
• CLAHE tile boundaries create detectable periodic artifacts at predictable spatial frequencies

• Works regardless of image semantic content — purely statistical detection

• Low computational cost using sliding-window histogram analysis
• Cannot distinguish CLAHE applied for legitimate photographic enhancement vs. forensic concealment
• Very low clip limits (close to 1.0) produce nearly undetectable traces

• Heavy JPEG compression can mask the subtle tile boundary artifacts

• Some camera firmware applies internal adaptive histogram equalization, creating false positives
Detecting post-processing attempts to normalize contrast in AI-generated images, identifying CLAHE usage in manipulated photographs to hide splicing boundaries, and forensic analysis of images where local contrast has been artificially boosted.