Edge Detection in Images Overview  

A problem of fundamental importance in image analysis is edge detection. Edges characterize object boundaries and are therefore useful for segmentation, registration, and identification of objects. A typical application where edge detection techniques are involved is automatic character recognition.
 
   Original Image                                        Edge Detection
 
 

Edges in an image are pixel locations with abrupt changes in gray levels. If we had a continuous image (i.e., assuming continuous values), we would say that the derivative of the image f(x,y) assumes a local maximum in the direction of the edge. Therefore, one edge detection technique is to measure the gradient of f in a particular location. This is accomplished by using a gradient operator.  Such operators, also called masks, provide finite-difference approximations of the orthogonal gradient vector  fand  fy.

Let H denote a p x p mask and x(m,n) denote an arbitrary image location. The gradient operators are represented by a pair of masks, H1 and H2, which measure the gradient of the image x(m,n) in the two orthogonal directions. We list  here some common gradient operators:

 
 
 

 
These gradient operators are used to compute the gradient of the image at every point in the image by evaluating the correlation of the image with the gradient operator. We label these values g1(m,n) and g2(m,n).

 

 Note: for the 2x2 matrices, the origin of the mask is in the position (1,1) and for the 3x3 matrices, the origin of the mask is in the middle of the matrix (position (2,2)).

The Prewitt and Sobel operators compute horizontal and vertical differences of local sums. This reduces the effect of noise in the data as well. Note that all the gradient operators have the desirable property of yielding zeros for uniform regions.

Once we have computed the gradient values, we can combine them to obtain the gradient vector magnitude

 

Finally, we decide that the pixel (m,n) for which we have calculated the gradient vector magnitude g(m,n) is an edge location if the gradient vector magnitude is sufficiently large (i.e., larger than a certain threshold t). In other words, the pixel location (m,n) is declared an edge location if g(m,n) exceeds a given threshold t, i.e. if g(m,n)³ t.  If we are interested only in
horizontal edges or vertical edges, then the decision is based on the values of  g1(m,n) and g2(m,n).

The foregoing techniques of estimating  gradients work best when the gray level transition is quite abrupt, such as for the tool image above. For smoother transitions, like in the case of the Lenna image, it is more advantageous to also compute the second-order derivative and to see when this second derivative crosses zero. If the second derivative crosses zero, it means that the location does indeed correspond to a maximum and we conclude therefore that this pixel location is an edge location. This technique is called the zero-crossing edge location technique. A common mask operator for the estimation of the second derivative is the Laplacian operator, defined as

 .