I-245Local Gradient Pattern Analysis

Pixel Analysisimage2014

Extracts local gradient pattern descriptors for texture micro-structure forensics at the patch level.

Local Gradient Pattern Descriptor
This method extracts gradient-based texture descriptors to characterize micro-structural patterns that differ between authentic and AI-generated images:1. Gradient Computation and Quantization: Horizontal and vertical gradients (Gx, Gy) are computed using Sobel or Scharr operators. At each pixel, the gradient magnitude M = √(Gx² + Gy²) and orientation θ = arctan(Gy/Gx) are calculated. The orientation is quantized into 8 bins (0°, 45°, 90°, ..., 315°). This creates a compact representation of local edge structure at each pixel location.2. Local Gradient Pattern (LGP) Encoding: Similar to Local Binary Pattern (LBP), the LGP descriptor compares the gradient magnitude of a center pixel against its P neighbors on a circle of radius R. For each neighbor i, a binary code b_i = 1 if M(neighbor_i) ≥ M(center), else 0. The LGP code is the P-bit binary number formed by concatenating these bits: LGP = Σ b_i × 2^i. With P=8 neighbors, this produces 256 possible patterns per pixel.3. Uniform Pattern Selection and Histogram: Following Ojala et al., 'uniform' LGP patterns (those with at most 2 bitwise transitions) are identified. These U2 patterns capture fundamental gradient micro-structures: spots (all 0s or all 1s), edges (half 0s/half 1s), and corners. The histogram of uniform LGP codes is computed for the entire image or for local patches, producing a 59-dimensional feature vector (58 uniform patterns + 1 non-uniform bin).4. Forensic Classification: The LGP histogram is compared against reference distributions from authentic and AI-generated image databases using chi-squared distance or histogram intersection. AI-generated images typically show: (a) higher frequency of uniform patterns due to smoother texture synthesis, (b) reduced gradient magnitude variance within patches, and (c) distinctive orientation histogram peaks at 0° and 90° from convolutional grid artifacts. An SVM or random forest classifier trained on these features provides the final authenticity decision.
Gradient operator: Scharr (3×3)
LGP radius R: 1 or 2 pixels

LGP neighbors P: 8

Orientation bins: 8 (45° each)

Uniform pattern count: 58 + 1 (non-uniform)

Patch size for local analysis: 64×64 pixels

Minimum image size: 64×64 pixels
80–88% accuracy for AI-generated image detection using LGP features alone. Combined with orientation histogram: AUC of 0.91. Manipulation detection (splicing/copy-move): F1-score of 0.83. LGP features are particularly effective on GAN-generated images (85–91% accuracy) but less effective on diffusion model outputs (75–82%).
• Local gradient patterns capture micro-texture details invisible to human observers
• Computationally efficient — integral histogram enables fast patch-level computation

• Rotation invariant when using uniform patterns

• Robust to monotonic illumination changes (gradient-based)

• Compact feature vector (59 dimensions) suitable for real-time classification
• Gradient-based features are sensitive to JPEG compression artifacts
• Performance drops on images smaller than 128×128 pixels

• AI models with explicit texture synthesis (StyleGAN3) produce more natural LGP distributions

• Uniform scaling or resampling alters gradient micro-structure patterns

• High-frequency noise can mask genuine gradient pattern differences
Detecting AI-generated images through gradient texture micro-structure analysis. Identifying spliced regions with inconsistent gradient patterns. Texture-based image classification for forensic analysis. Feature extraction for machine learning forensic pipelines.