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!
Answer
There are lots of edge detection possibilities, but the 3 examples you mention happen to fall in 3 distinct categories.
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.
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:
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.
No comments:
Post a Comment