Skip to main content

Crate blazediff_interpret

Crate blazediff_interpret 

Source
Expand description

Structured region analysis: given two images and a set of changed regions, describe what changed in each one.

The classifier is deliberately separate from whatever found the regions. blazediff finds them by connected components over a pixel-diff mask, blazediff-ssim can find them by thresholding a score map, and a caller can simply supply them — DOM rectangles, a JS-side diff, anything. All three get identical per-pixel classification, because a coarse region is refined against the source pixels before any statistic is computed.

use blazediff_interpret::{interpret, types::BoundingBox, ChangeSource};
let result = interpret(&a, &b, ChangeSource::Regions(&[BoundingBox { x: 8, y: 8, width: 16, height: 16 }]))?;
println!("{}", result.summary);

Re-exports§

pub use types::BoundingBox;
pub use types::ChangeRegion;
pub use types::ChangeSeverity;
pub use types::InterpretResult;

Modules§

types

Structs§

ComponentInfo
YIQ squared-delta floor for treating a pixel as actually changed. 100.0 corresponds to a YIQ-weighted distance of 10, roughly equivalent to a perceptual delta of ~0.017 — filters near-identical pixels without throwing away genuine edits.

Enums§

ChangeSource
Where the change information came from.
InterpretError
Why a set of regions could not be interpreted.

Functions§

build_summary
classify_region
Classify a known change region against a provided full-image change mask.
classify_regions
Classify multiple known regions, then run the same shift relabeling pass used by interpret() so classifier-only verification can evaluate final labels.
classify_severity
Classify severity from diff percentage.
detect_regions
YIQ squared-delta floor for treating a pixel as actually changed. 100.0 corresponds to a YIQ-weighted distance of 10, roughly equivalent to a perceptual delta of ~0.017 — filters near-identical pixels without throwing away genuine edits. Full region detection pipeline: binary mask → morph close → connected components → extract with original mask
detect_shifts
Post-classification pass: match Deletion regions in img1 with structurally “appearance” regions in img2 (Addition, ContentChange, ColorChange) whose content is similar enough to be the same object moved to a new location. When a pair clears the size + luminance match it is re-labelled Shift on both sides.
extract_change_mask
YIQ squared-delta floor for treating a pixel as actually changed. 100.0 corresponds to a YIQ-weighted distance of 10, roughly equivalent to a perceptual delta of ~0.017 — filters near-identical pixels without throwing away genuine edits. Extract change mask from output image: a pixel is changed if it’s not grayscale (R != G or R != B).
interpret
Describe what changed between two images.
interpret_diff
Run a pixel diff and interpret it, optionally keeping the visualization.
mask_options
The DiffOptions a diff must run with for ChangeSource::Diff to be able to recover its mask.
recolor_output
Repaint a mask-coloured visualization in the caller’s palette.
regions_from_score_map
Turn a lower-resolution scalar score map into regions in image coordinates.