In practice, finite difference approximations of first-order directional derivatives are used. These are represented by a pair of masks, say hx and hy. Formally these are linear phase FIR
filters. A convolution
of the image with hx
gives two directional derivative images gx
, respectively. The gradient image is traditionally calculated as
, or alternatively using
| + |gy
]. A pixel location is declared an edge location, if the value of
(at point x
) exceeds some threshold. The locations of all edge points constitutes an edge map. The selection of a threshold value is an important design decision that depends on a number of factors, such as image brightness, contrast, level of noise, and even edge direction. Typically, the threshold is selected following an analysis of the gradient image histogram. It is sometimes useful to calculate edge direction information. This is given by
The Canny [Can86
] and the Shen and Castan [She92
] edge detectors are possibly the most widely known and used methods for detecting edges. These are classic gradient operators, conceptually easy to understand, effective, and yet simple to implement. Canny proposed the use of the derivative of the Gaussian function as an optimal edge filter, while Shen and Castan using a different optimality criterium proved that the best edge filter should be based on a derivative of the symmetric exponential function. Here are the 1D versions of the two filters.
A zero-crossing edge operator was originally proposed by Marr and Hildreth [Mar80
]. They suggested that in order to effectively detect intensity changes (edges), the operator needs to have two characteristics. First, it must be a differential operator, taking either a first or second spatial derivative of the image. Second, it should be capable of being tuned to act at any desired scale, so that large filters can be used to detect blurry shadow edges, and small ones can be used to detect sharply focused fine detail in the image. This led to the so-called Laplacian-of-Gaussian edge operator. This is a compound operator, which combines a smoothing operation, using a Gaussian-shaped linear phase FIR filter, with a differentation operation, using a discrete Laplacian. The edges are identified by the location of zero-crossings (recall that the second derivative changes sign in the vicinity of maxima of the first derivative).