34
$\begingroup$

I've learned about a number of edge detection algorithms, including algorithms like Sobel, Laplacian, and Canny methods. It seems to me the most popular edge detector is a Canny edge detector, but is there cases where this isn't the optimal algorithm to use? How can I decide which algorithm to use? Thanks!

$\endgroup$
1
  • 7
    $\begingroup$ What are you detecting? $\endgroup$
    – endolith
    Aug 19, 2011 at 15:28

5 Answers 5

29
$\begingroup$

There are lots of edge detection possibilities, but the 3 examples you mention happen to fall in 3 distinct categories.

Sobel

This approximates a first order derivative. Gives extrema at the gradient positions, 0 where no gradient is present. In 1D, it is = $\left[ \begin{array}{ccc} -1 & 0 & 1 \end{array} \right]$

  • smooth edge => local minimum or maximum, depending on the signal going up or down.
  • 1 pixel line => 0 at the line itself, with local extrema (of different sign) right next to it. In 1D, it is = $\left[ \begin{array}{ccc} 1 & -2 & 1 \end{array} \right]$

There are other alternatives to Sobel, which have +/- the same characteristics. On the Roberts Cross page on wikipedia you can find a comparison of a few of them.

Laplace

This approximates a second order derivative. Gives 0 at the gradient positions and also 0 where no gradient is present. It gives extrema where a (longer) gradient starts or stops.

  • smooth edge => 0 along the edge, local extrema at the start/stop of the edge.
  • 1 pixel line => a "double" extremum at the line, with "normal" extrema with a different sign right next to it

The effect of these 2 on different types of edges can be best viewed visually:

Comparison of Sobel vs Laplace

Canny

This is not a simple operator, but is a multi-step approach, which uses Sobel as one of the steps. Where Sobel and Laplace give you a grayscale / floating point result, which you need to threshold yourself, the Canny algorithm has smart thresholding as one of its steps, so you just get a binary yes/no result. Also, on a smooth edge, you will likely find just 1 line somewhere in the middle of the gradient.

$\endgroup$
18
$\begingroup$

While Sobel and Laplacian are simply filters, Canny goes further than that in two ways.

First, it does non-maximum suppression which gets rid of noise produced by all sorts of objects and color gradients in an image. Secondly, it actually includes a step that allows you to discern between different edge directions and to fill missing points of a line.

In other words, Canny edge detector is in a completely different class from Sobel and Laplacian. It's much smarter in that it includes a whole bunch of post processing whereas Sobel and Laplacian are simply high pass filter outputs followed by linear binary thresholding.

$\endgroup$
1
  • $\begingroup$ is there a 1-D version of canny in this regards? Would it simply be a straight forward application of the 2-D version? $\endgroup$
    – Spacey
    Mar 21, 2012 at 14:53
9
$\begingroup$

The two most important decisions when trying to detect edges are, to me usually:

  1. Can I segment the objects instead, and then use a morphological operator to find the edge of the binary (segmented) image? With noisy data, this tends to be more robust.

  2. What edge-preserving smoothing filter should I use to reduce image noise? Edge filters are based on differencing, which will suffer with noisy data. The simplest choice is the median filter, but anisotropic diffusion or nonlocal means filters will offer better performance at the cost of having more parameters to tweak.

For edge detection itself, I can't think for a good reason not to use Canny.

$\endgroup$
7
$\begingroup$

SUSAN Approach

Another approach to edge and corner detection is the SUSAN approach.

In this approach, rather than derivative approximations, an integral approximation approach is used. This has the advantage of not only being able to detect edges, but also to be able to detect "two dimensional features" (i.e. corners).

Another advantage of a integral approximation approach is that noise tends to have less of an effect on the results.

$\endgroup$
6
$\begingroup$

Canny yields a binary image and is dependent on externally given thresholds (which are image/application dependent).
Convolution based filters yield an "edge intensity" image. This is useful if the edge weight or strength is important (e.g. in weighted Hough Transform).

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.