[][src]Function imageproc::edges::canny

pub fn canny(
    image: &GrayImage,
    low_threshold: f32,
    high_threshold: f32
) -> GrayImage

Runs the canny edge detection algorithm.

Returns a binary image where edge pixels have a value of 255 and non-edge pixels a value of 0.

Params

  • low_threshold: Low threshold for the hysteresis procedure. Edges with a strength higher than the low threshold will appear in the output image, if there are strong edges nearby.
  • high_threshold: High threshold for the hysteresis procedure. Edges with a strength higher than the high threshold will always appear as edges in the output image.

The greatest possible edge strength (and so largest sensible threshold) issqrt(5) * 2 * 255, or approximately 1140.39.

This odd looking value is the result of using a standard definition of edge strength: the strength of an edge at a point p is defined to be sqrt(dx^2 + dy^2), where dx and dy are the values of the horizontal and vertical Sobel gradients at p.