pub fn estimate_noise_sigma_u8(
img: &[u8],
width: u32,
height: u32,
) -> Result<Option<f32>, ChessError>Expand description
Estimate the standard deviation of an 8-bit grayscale image’s pixel noise, in gray levels.
This is the estimate Detector uses to express
position covariances in px² under
NoiseLevel::Estimate; calling it on the
same image returns the same value. Strong
edges, corners, smooth shading and areas near black or white are
excluded, so it suits images dominated by a calibration board. It is not
reliable on demosaiced or JPEG images; supply
NoiseLevel::Known for those. Cost is independent of the image size (well under a
millisecond).
img is width * height bytes, row-major. Returns Ok(None) when the
image is smaller than 4×4 or has too few structure-free areas for an
estimate. The full accuracy statement is on
[chess_corners_core::estimate_noise_sigma_u8].
// A flat gray image with no noise: the estimate is the 8-bit
// rounding floor, near zero.
let img = vec![128u8; 64 * 64];
let sigma = chess_corners::estimate_noise_sigma_u8(&img, 64, 64)?;
assert!(sigma.is_none_or(|s| s < 0.5));§Errors
Returns ChessError::DimensionMismatch if img.len() != width * height.