diff --git a/src/filter/canny.rs b/src/filter/canny.rs index 26ddc9d..ec82c87 100644 --- a/src/filter/canny.rs +++ b/src/filter/canny.rs @@ -11,7 +11,7 @@ use crate::kernel::Kernel; use crate::*; pub fn canny(img: Image) -> Image { - let blurred = kernel::gaussian::<5>(2.0).convolve(&img); + let blurred = kernel::gaussian::<5>(1.4).convolve_sat(&img); let sobel = filter::sobel(blurred); let maxima = gradient_threshold(sobel); let candidates = double_threshold(maxima); diff --git a/src/filter/sobel.rs b/src/filter/sobel.rs index d8154fa..cb4def0 100644 --- a/src/filter/sobel.rs +++ b/src/filter/sobel.rs @@ -23,8 +23,8 @@ const KERNEL_Y: [[f32; 3]; 3] = [[-1.0, -2.0, -1.0], [0.0, 0.0, 0.0], [1.0, 2.0, 1.0]]; pub fn sobel(img: Image) -> Image { - let x_edges = KERNEL_X.convolve(&img); - let y_edges = KERNEL_Y.convolve(&img); + let x_edges = KERNEL_X.convolve_sat(&img); + let y_edges = KERNEL_Y.convolve_sat(&img); let mut result = image::Image::::with_extent(x_edges.extent); result.for_each(|x, y, p| {