Use convolve_sat in canny and sobel
This commit is contained in:
1 parent
5b940c2192
commit
c8c71cc07e
2 files changed
+3
-3
No files matched your search
+1
-1
@@ -11,7 +11,7 @@ use crate::kernel::Kernel;
|
||||
use crate::*;
|
||||
|
||||
pub fn canny(img: Image<Luminance>) -> Image<Luminance> {
|
||||
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);
|
||||
|
||||
+2
-2
@@ -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<Luminance>) -> Image<Vector> {
|
||||
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::<Vector>::with_extent(x_edges.extent);
|
||||
result.for_each(|x, y, p| {
|
||||
|
||||
Reference in new issue
Block a user