The Canny and the Shen - Castan Methods

Edge Detection
 An edge is a boundary between an object

and the background, and indicates the boundary between overlapping objects.  Edges form the outline of an object, so if the edges are identified in an image accurately, then all the objects can be located and basic properties such as area, perimeter can be measured.  Edge detection is based on the relationship a pixel has with its neighbors.

Edge Detection
 Edges, in an image are defined as locations where there is a significant variation in the gray level or color of pixel in some direction.  Edge detection extracts and localizes points (pixels) around which a large change in image brightness has occurred.  This can help in the process of segmentation

Traditional Approaches Ideal Step Edge :(The most common definition of an edge)
 In 1-d the edge is simply a change in gray level occurring at one specific location (fig.1a). The greater the change in the level, the easier the edge is to detect.



Step Edge Detection

Problems in Edge Detection  Problems:1)Because of digitization:-The image may be sampled in such a way so that change in gray level may extend across some number of pixels. Fig 1b-d. 2)Because of noise:-Due to factors such as light intensity, type of camera and lens, motion, temperature, dust and others.

Noise
Two types of noise are of interest in image analysis:1) Signal ±independent:-noise is a random set of gray levels, statistically independent of the data. It occurs during electronically transmission of image. If A is a perfect image and N is the noise that occurs during transmission, then the final image B is B=A+N 2) Signal-dependent noise:- In this the level of the noise value at each point in the image is a function of the grey level there.

Derivative Operators
  An operator, that is sensitive to change in gray level will operate as an edge detector- A derivative operator does this. Interpretation of derivative:- The rate of change of function. The rate of change of the gray levels in an image is large near an edge and small in constant areas. In images are 2-D, so level changes are considered in many directions. For this reason partial derivatives of the image are used with respect to the principal directions x and y. Let A (x, y) be an image then the gradient is defined as: ¨A (x ,y) = (A / x, A / y)



Because image is discrete, the derivative at a pixel is approximated by the difference in gray levels over some local region. The simplest approximation is the operator ¨1:

x1A(x, x2A(x,

y) = A(x, y) ± A(x-1, y) y) = A(x, y) ± A(x, y-1)

Problem with this operator:- It does not compute the gradient at the point (x, y), but at (x-1/2, y-1/2) Assumption:- the grey levels vary linearly between the pixels.

A better choice for an approximation is
x2

A(x, y) = A(x+1, y) ± A(x-1 ,y)

A(x, y) = A(x, y+1) ± A(x, y-1) This operator is symmetrical with respect to the pixel (x, y). It does not consider the value of the pixel at (x, y). The edge response is given by:
y2

Gmag = ¥((A » x)2 + (A »y)2)

and the direction of the edge is approximately: Gdir = atan (A »y) » ( A » x) Edge pixel- which exceeds the threshold value

Examples

Examples

Measures of Performance of Edge Detection Schemes
 False Positive  False Negative  Using Function (Pratt 1978) E1 =(1/(1+ d(i)2)) / max(IA,II) IA = the number of edge pixels found by the edge detector II= the number of edge pixels in the test image d(i)=the distance between the actual ith pixel and the one found by the edge detector is used for scaling

Measures of Performance
Evaluation scheme based on local edge coherence (Kitchen and Rosenfeld) (a) It measures how well an edge pixel is continued on the left; this function is L(k) =a(d,dk) a(k /4,d+ /2) if neighbor k is an edge pixel 0 otherwise where d is the edge direction at the pixel being tested d0 is the edge direction at its neighbor to the right d1 is the direction of the upper-right neighbor, and so on Counterclockwise about the pixel involved a= the measure of the angular difference between any two angles 

Measures«
a( , ) = -| - | » (b) A similar function measures directional continuity on the right of the pixel being evaluated: R(k) = a(d,dk) a(k /4,d+ /2) if neighbor k is an edge pixel 0 otherwise (c) C= Overall continuity measure = average(L(k), R(k)) (d) Then measure of thinness (T) is applied. (e) The overall evaluation of the edge detector is: (f) E2 = C + (1- ) T

Template-Based Edge Detection
 This uses a small, discrete template as a model of an edge instead of using a derivative operator.  Exampes:(a) Sobel Edge Detector (b) Kirsch Edge Detector

Sobel Edge Detector
 It uses templates in the form of convolutional masks having the following values. -1 -2 -1 0 0 0 = SY 1 2 1 -1 0 1 -2 0 2 = Sx -1 0 1

For a pixel at image coordinates (I,j), SX SY can be computed by

Sobel Edge Detector
SX = I[i-1][j+1]+2I[i][j+1]+I[i+1][j+1](I[i-1][j-1]+2I[i][j-1]+I[i+1][j-1]) SY = I[i+1][j+1]+2I[i+1][j]+I[i+1][j-1]-(I[i-1][j+1]+ 2I[i-1][j]+I[i-1][j-1])  After SX Sy are computed for each pixel, resulting magnitude must be thresholded

Figure

Kirsch Edge Detector
 These templates has different motivation than Sobel¶s.  For the 3X3 case the templates are: -3 -3 5 -3 5 5 5 5 5 5 5 -3 K0= -3 0 5 K1=-3 0 5 K2= -3 0 -3 K3= 5 0 -3 -3 -3 5 -3 -3 -3 -3 -3 -3 -3 -3 -3 5 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 K4=5 0 -3 K5= 5 0 -3 K6= -3 0 -3 K7= -3 0 5 5 -3 -3 5 5 -3 5 5 5 -3 5 5

Kirsch Edge Detector
These masks are to observe the grey level change near an edge having various orientations, rather than approximation to the gradient. There are one mask for each of eight compass directions. For example, a large response to mask K0 implies a vertical edge (horizontal gradient) at the pixel corresponding to the center of the mask. Method:To find the edges, an image I is convolved with all of the masks at each pixel position. The response of the operator at a pixel is the maximum of the responses of any of the eight masks. The direction of the edge pixel is quantized into eight possibilities and is /4 *I where I is the number of the mask having the largest response.

EDGE MODELS : Marr- Hildreth Edge Detection
Marr studied the literature on mammalian visual systems and summarized these in five major points:1. In natural images, features of interest occur at a variety of scales. No single operator can function at all of these scales, so the result of operations at each of scales should be combined. 2. Diffraction patterns does not occur in a natural scene, so some local averaging (smoothing) must take place.

Marr-Hildreth Edge Detection
3.The optimal smoothing filter that matches the observed requirements of biological vision is the Gaussian. 4. When a change in intensity (edge) occurs, there is an extreme value in the first derivative or intensity. This corresponds to a zero crossing in the second derivative. 5. The orientation-independent differential operator of lowest order is the Laplacian.

Marr-Hildreth Edge Detection Algorithm
1. Convolve the image I with a twodimensional Gaussian function. 2. Complete the Laplacian of the convolved image; call this L 3. Edge pixels are those for which there is a zero crossing in L.

Marr«
 A convolution in two dimensions is given by: I* G(I, j) = I(n, m) G(i-n, j-m)
n m

 The function G being convolved with the image is a two dimensional Gaussian: G (x, y) = 2 exp{-(x2 + y2) » 2 Gaussian must be sampled to create

Marr«
a small two dimensional image.  After the convolution, the Laplacian operator can be applied. 2 = 2 » x2 + 2 » y2

Examples

Examples

Strength and weaknesses
Advantage: This is much better than the previous ones in cases of low signal to noise ratio. Disadvantages of the method:1) Low evaluation. 2) Locality is not good, the edges are not always thin.

The Canny Edge Detector
Canny specified three issues that an edge detector must address. They are:1.Error rate:-The edge detector should respond only to edges, and should find all of them; no edges should be missed. 2.Localization:- The distance between the edge pixels as found by the edge detector and the actual edge should be as small as possible. 3.Response:- The edge detector should not identify multiple edge pixels where only a single edge exists.

Canny Edge Detector
noise.  The edge detector was assumed to be a convolution filter f that would smooth the noise and locate the edge. So the problem is to identify the one filter that optimizes the three edge detection criteria. In one ±dimension, the response of the filter f to an edge G is given by a convolution integral
-W

 Canny assumed that a step edge subject to white Gaussian

H =  G(-x)f(x)dx
W

Canny«
The filter is assumed to be zero outside of the region [-W, W]. Mathematically the three criteria are expressed as:
0 W

SNR= (A |  f(x) dx | ) » n0 ¥  f2(x) dx
-W -W W

Localization = A | f(0)| » n0 ¥  f2(x) dx
-W

Canny«
 

xzc =

( f2(x) dx ) » (  f µ 2(x) dx)
- -

The value of SNR is the error rate. The localization value represents the reciprocal of the distance of the located edge from the true edge. The value of xzc is the mean distance between zero crossings of f·.

The Canny Edge Detection Algorithm
 Read in the image to be processed I.  Create a 1D Gaussian mask G to convolve with I. The standard deviation s of this Gaussian is a parameter to the edge detector.  Create a 1D mask for the first derivative of the Gaussian in the x and y directions; call these Gx and Gy. The same s value is used as in step 2.

Canny Edge Detection ( continued)
Convolve the image I with G along the rows to give the x component image IX, and down the columns to give the y component image Iy.  Convolve IX with GX to give IX¶ , the x component of I convolved with the derivative of the Gaussian function and  Convolve IY with GY to give IY¶.  To view the result the x and y component must be combined. The magnitude of the result at pixel (x,y) is M(x,y) = ¥ IX¶(x,y)2 + IY¶(x,y)2

Canny..
 The final step in the Canny edge detector is a nonmaximum suppression step, where pixels that are not local maxima are removed.  As an extra step, Canny suggests thresholding using hysteresis rather than simply selecting a threshold value to apply everywhere. Hysteresis thresholding uses a high threshold Th and low threshold Tl.

Examples: Canny

Examples : Canny

The Shen-Castan (ISEF) Edge Detector
Canny¶s detector defined optimally with respect to a specific set of criteria. Shen and Casten used different function to optimize following function for 1D): C2N =( 4  f2(x)dx.  f¶2(x)dx) » f4(0) The function that minimizes CN is the optimal smoothing function filter for an edge detector. The optimal filter function they used is the infinite symmetric exponential filter (ISEF): f(x) =( p/2 ) exp(-p|x|)

Comparison of Two Optimal Edge Detectors
 Shen-Castan method provides better S/N than Canny¶s filter.It also provides better localization than Canny¶s operator.This is because the implementation of Canny¶s algorithm approximates his optimal filter by the derivative of a Gaussian, whereas Shen use the optimal filter directly.  Since Shen method does not address the multiple response criterion, it is possible that their method will create spurious response to noisy and blurred edges.

Figures