Skip to main content

sampling_insensitive_error

Function sampling_insensitive_error 

Source
pub fn sampling_insensitive_error(
    a: &[u8],
    b: &[u8],
    width: usize,
    height: usize,
    offset: (i32, i32),
    mask: Option<(&[u8], u8)>,
    radius: i32,
    points: &[i64],
) -> (f64, f64)
Expand description

refine_native_at’s cost of the points at offset, and its runner-up (the lowest cost at an offset more than two pixels from it, within radius), with each point compared by Birchfield and Tomasi’s sampling-insensitive dissimilarity (“A Pixel Dissimilarity Measure That Is Insensitive to Image Sampling”, 1998) instead of the plain difference. Each value is compared with the range the other image spans within half a pixel of the matching position (the halfway points to its four neighbours), and the smaller of the two directions counts, so content that moved by a fraction of a pixel costs what it would at whole-pixel motion. Displacements of a pixel or more still cost in full. Infinite where fewer than 12 points fall inside both frames, as in the plain cost.