Skip to main content

detect_bad_pixels

Function detect_bad_pixels 

Source
pub fn detect_bad_pixels(
    raw: &RawImage,
    threshold_factor: f32,
) -> Vec<(u32, u32)>
Expand description

Detect candidate bad pixels using a threshold relative to local median.

For each pixel the median of its same-CFA-color neighbors in a 5×5 window is computed. If |pixel - median| > threshold_factor * median the pixel is considered bad and its coordinates are appended to the returned list.

A typical value for threshold_factor is 0.5, meaning the pixel must deviate more than 50% from the local neighborhood median.

Returns a list of (x, y) coordinates of suspected bad pixels.