Skip to main content

struct_diff

Function struct_diff 

Source
pub fn struct_diff(a: &CaptureImage, b: &CaptureImage) -> f32
Expand description

Shape-aware difference in 0.0..=1.0: downscale each image to a small grayscale grid, take the Sobel edge magnitude, normalize each edge map by its own peak, and mean-abs-diff them. Normalizing per-image cancels overall contrast, so a recolor of the same shape scores low while a different shape scores high — the near-duplicate probe (an approximation of SSIM).