Function edge_detection::canny
source · [−]pub fn canny<T: Into<GrayImage>>(
image: T,
sigma: f32,
strong_threshold: f32,
weak_threshold: f32
) -> Detection
Expand description
Computes the canny edges of an image.
The variable sigma
determines the size of the filter kernel which affects the precision and
SNR of the computation:
- A small sigma (3.0<) creates a kernel which is able to discern fine details but is more prone to noise.
- Larger values result in detail being lost and are thus best used for detecting large features. Computation time also increases.
The weak_threshold
and strong_threshold
determine what detected pixels are to be regarded
as edges and which should be discarded. They are compared with the absolute magnitude of the
change in brightness.
Panics:
- If either
strong_threshold
orweak_threshold
are outisde the range of 0 to 1 inclusive. - If
strong_threshold
is less thanweak_threshold
. - If
image
contains no pixels (either it’s width or height is 0).