pub fn bilateral_filter(
image: &GrayImage,
window_size: u32,
sigma_color: f32,
sigma_spatial: f32,
) -> Image<Luma<u8>>
Expand description
Denoise 8-bit grayscale image using bilateral filtering.
§Arguments
image
- Grayscale image to be filtered.window_size
- Window size for filtering.sigma_color
- Standard deviation for grayscale distance. A larger value results in averaging of pixels with larger grayscale differences.sigma_spatial
- Standard deviation for range distance. A larger value results in averaging of pixels separated by larger distances.
This is a denoising filter designed to preserve edges. It averages pixels based on their spatial
closeness and radiometric similarity [1]. Spatial closeness is measured by the Gaussian function
of the Euclidean distance between two pixels with user-specified standard deviation
(sigma_spatial
). Radiometric similarity is measured by the Gaussian function of the difference
between two grayscale values with user-specified standard deviation (sigma_color
).
§References
[1] C. Tomasi and R. Manduchi. “Bilateral Filtering for Gray and Color Images.” IEEE International Conference on Computer Vision (1998) 839-846. DOI: 10.1109/ICCV.1998.710815
§Examples
use imageproc::filter::bilateral_filter;
use imageproc::utils::gray_bench_image;
let image = gray_bench_image(500, 500);
let filtered = bilateral_filter(&image, 10, 10., 3.);