Canny edge detection is a multi-step algorithm that can detect edges with noise supressed at the same time.

- Smooth the image with a Gaussian filter to reduce noise and unwanted
details and textures.

where

- Compute gradient of using any of the gradient operatiors
(Roberts, Sobel, Prewitt, etc) to get:

and

- Threshold M:

where is so chosen that all edge elements are kept while most of the noise is suppressed. - Suppress non-maxima pixels in the edges in obtained above to
thin the edge ridges (as the edges might have been broadened in step 1).
To do so, check to see whether each non-zero is greater
than its two neighbors along the gradient direction . If so,
keep unchanged, otherwise, set it to 0.
- Threshold the previous result by two different thresholds
and (where ) to obtain two binary images and
. Note that with greater has less noise and fewer false
edges but greater gaps between edge segments, when compared to with
smaller .
- Link edge segments in to form continuous edges. To do so,
trace each segment in to its end and then search its neighbors in
to find any edge segment in to bridge the gap untill reaching
another edge segment in .

**Example 1: **

Edge detection by gradient operators (Roberts, Sobel and Prewitt):

Edge detection by LoG and DoG:

Edge detection by Canny method (, , ):

**Example 2: **

Edge detection results by Sobel, Prewitt gradient operators, by DoG method and by Canny's method (, , ):