This is documentation for an obsolete product.

# 7.3 Edge Detection

 In[1]:=
 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
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 and hy gives two directional derivative images gx and gy, respectively. The gradient image is traditionally calculated as , or alternatively using = |gx| + |gy| [Gon92]. A pixel location is declared an edge location, if the value of (at point x, y) 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 .

Edge operators.

Option of EdgeMagnitude.

 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=
 In[6]:=
 In[7]:=
 Out[7]=
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.
 In[8]:=
 Out[8]=
 In[9]:=
 Out[9]=
 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=
 In[12]:=
 In[13]:=
 Out[13]=
 In[14]:=
 Out[14]=
 In[15]:=
 Out[15]=
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).

Edge detection filters.

 In[16]:=
 In[17]:=
 Out[17]=
 In[18]:=
 Out[18]=
 In[19]:=
 Out[19]=
 In[20]:=
 Out[20]=
 In[21]:=
 In[22]:=
 Out[22]=