I-234Focus Depth Gradient Analysis
Analyzes focus depth gradients for optical consistency — real lenses create smooth focus transitions that AI often fails to replicate.
Algorithm / Model
Depth-of-Field Gradient Analysis
How it works
This method verifies that the blur gradient in an image follows the thin-lens depth-of-field model, detecting AI-generated images where focus transitions are physically implausible:1. Blur Estimation Map: Local blur is estimated at each 16×16 block using the variance of the Laplacian operator (σ²_L). Sharp regions yield high σ²_L values, while defocused regions show low values. The blur map is normalized to produce a continuous depth-of-field (DoF) estimate across the image.2. Thin-Lens Model Fitting: For a real camera with focal length f, aperture N, and focus distance d_f, the circle of confusion (CoC) at depth d follows CoC(d) = |f²(d − d_f)| / (N · d · (d_f − f)). The method fits this model to the estimated blur map using least-squares optimization, estimating d_f, f, and N. The residual error R indicates how well the blur pattern matches a physical lens.3. Gradient Consistency Check: In real photography, the blur gradient ∂CoC/∂d changes monotonically with depth (increasing for objects behind the focal plane, decreasing for objects in front). The method traces the blur gradient along depth discontinuity boundaries. Authentic images show smooth, monotonic blur transitions; AI-generated images frequently show non-monotonic blur (e.g., sharp→blurry→sharp transitions without depth basis).4. Bokeh Quality Analysis: Out-of-focus highlights (bokeh) in real images form disc shapes determined by the aperture blade geometry. The method detects specular highlights in blurred regions and analyzes their shape: real bokeh shows consistent disc/polygon shapes with cat's-eye distortion at the periphery. AI-generated bokeh often shows inconsistent shapes, missing cat's-eye effect, or unrealistic chromatic fringing patterns.
Technical Parameters
Blur estimation: Laplacian variance on 16×16 blocks
Thin-lens parameters: focal length 10–400mm, aperture f/1.4–f/22
Model fit residual threshold: R > 0.3 indicates non-physical blur
Gradient monotonicity: tolerance 5% non-monotonic samples
Bokeh shape analysis: minimum 3 specular highlights required
Minimum image size: 512×512 pixels
Thin-lens parameters: focal length 10–400mm, aperture f/1.4–f/22
Model fit residual threshold: R > 0.3 indicates non-physical blur
Gradient monotonicity: tolerance 5% non-monotonic samples
Bokeh shape analysis: minimum 3 specular highlights required
Minimum image size: 512×512 pixels
Accuracy & Reliability
80–88% detection accuracy for AI-generated images with depth-of-field effects. Thin-lens model fitting achieves 84% accuracy in identifying non-physical blur patterns. Bokeh analysis reaches 90% when sufficient specular highlights are present. Performance drops to 72% on images with very deep DoF (f/8 or smaller) where blur gradients are minimal.
Strengths
• Based on well-defined optical physics (thin-lens equation)
• Non-monotonic blur transitions are strong evidence of AI generation
• Bokeh shape analysis provides visual, interpretable forensic evidence
• Effective on portrait, product, and macro photography with shallow DoF
• Can estimate the camera parameters (focal length, aperture) used for authentic images
• Non-monotonic blur transitions are strong evidence of AI generation
• Bokeh shape analysis provides visual, interpretable forensic evidence
• Effective on portrait, product, and macro photography with shallow DoF
• Can estimate the camera parameters (focal length, aperture) used for authentic images
Limitations
• Deep depth-of-field images (landscapes at f/11+) show minimal blur variation
• Tilt-shift lenses create non-standard blur gradients that may trigger false positives
• Computational bokeh (smartphone portrait mode) may not follow thin-lens physics
• Multiple focus stacking may create complex blur patterns
• Requires sufficient depth variation in the scene for meaningful analysis
• Tilt-shift lenses create non-standard blur gradients that may trigger false positives
• Computational bokeh (smartphone portrait mode) may not follow thin-lens physics
• Multiple focus stacking may create complex blur patterns
• Requires sufficient depth variation in the scene for meaningful analysis
Use Case
Detecting AI-generated images with unrealistic depth-of-field effects. Verifying portrait photographs for authentic bokeh rendering. Identifying composite images where foreground and background blur patterns are inconsistent with a single lens.