Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

Edge Detection by liaoqinmei

VIEWS: 9 PAGES: 3

									                                 Canny Edge Detection
                                   By: Steven Cheng

Introduction:
Edges characterize boundaries and therefore edge detection is a fundamental problem of
video signal processing. Edge detection methods significantly reduce the amount of data
to be processed and filters out useless information, at the same time preserving important
structural features of the images. Two main method of edge detection exist, the gradient
method and the Laplacian method. After consulting various sources it has been
determined that the Laplacian method is more sensitive to noise than the gradient method.
As a result, the Very-large-scale integration (VLSI) team has decided to design and to
implement the gradient method in particular the Sobel Edge Detection (SED) algorithm.


Sobel Edge Detection:
SED algorithm takes in a greyscale image and determines the gradient in each of the
vertical, horizontal, and diagonal directions centered on the center cell. One major
problem associated with the SED is that it is vulnerable to noise and leads to “false
edges” being detected as shown in Figure 1.




             Original                Adding Salt and Pepper Noise      Image after SED

                   Figure 1: Images Showing Noise Vulnerability of SED

In order to further enhance the functionalities of the edge detection FPGA and to
overcome the noise vulnerability of the SED, it is decided that Canny Edge Detection
(CED) algorithm is the best choice of edge detection algorithm to implement.


Canny Edge Detection
CED operates by convolving a Gaussian mask with the greyscale input. The outcome of
the image is a slightly blurred version of the original, and a single noise pixel would have
little or no effect on the overall image. Then the same algorithm from SED is applied to
the smoothed Gaussian image to find the edges.

Gaussian Mask:
To perform smoothing of the input, a Gaussian mask is convoluted with the input. A
Gaussian distribution graphed in a 3D manner should appear like Figure 2.
        Figure 2: Gaussian Mask with a Standard Deviation of 1 with mean (0,0)

Since the image is stored in discrete pixels, the Gaussian mask will be a discrete
approximation of the Gaussian function. The size and the standard deviation are two
important criteria that need to be taken into consideration when creating the Gaussian
mask. Larger sizes of the Gaussian mask will mean that the edge detection will be less
susceptible to noise; however, larger mask also leads to more calculations and therefore a
slower performance. The standard deviation should be chosen in such a way that the
Gaussian mask provides an accurate representation of a Gaussian curve. The mask only
needs to represent the first three standard deviations of the Gaussian curve. Convolution
with numerical values outside of the three standard deviation range has little effect on the
image. If the standard deviation is too small, the three standard deviation range will not
be accurately represented; if too big, extra calculations with little contribution will be
performed. Graphically, we want to minimize the flat portions in Figure 2 and at the same
time retain as much of the curved surface area as possible.

Due to the hardware functionalities of the Altera FPGA board that the VLSI team is using,
it is ideal to choose numerical values that are multiples of two. This way, the convolution
process can be easily performed by bit shifting instead of floating point calculations. The
downside associated with this is that the Gaussian mask would not be a very close
approximation to the Gaussian curve. After consultation with a professor at University of
Waterloo involved in signal processing, it is determined that the loss in approximation
accuracy would be within acceptable levels such that the image integrity would not be
compromised. The preliminary Gaussian mask is a 5x5 matrix with a standard deviation
of approximately 1.36.
              1/256*         2           4      4        4         2
                             4           8     16        8         4
                             4          16     32       16         4
                             4           8     16        8         4
                             2           4      4        4         2

                       Gaussian Mask with Standard Deviation of 1.36

*Note: The value here should be the sum of all 25 numbers in the matrix, 184. This is
needed to normalize all values within the matrix to represent Gaussian curve values. This
value must be equal to or greater than the sum of matrix elements. To further simplify the
calculations, 184 is changed to 256 to take advantage of bit-shifting and therefore speed
up the calculation phase.

The convolution can be performed using the following equation:




where: g(k,l) = convolutional kernel
I(x,y) = original image
I’(x,y) = filtered image
2N + 1 = size of convolutional kernel

I’(x,y) would be an image of the same size as the input but with Gaussian blurring. Then
the Sobel algorithm is applied to this image to determine the edges.

Possible Improvements:

Other techniques associated with CED such as hysteresis thresholding and multi-scale
representation can be added to improve the edge detection of the algorithm. These extra
features do however lengthen the execution time of the program. Due to the real-time
requirement of the project, fast execution is crucial. Further testing of the code and the
hardware specifications on the camera will dictate whether these will be added. If speed
allows, Gaussian matrix can be recalculated to use integers and use floating point
calculation instead of bit shifting, which should also improve the performance of the edge
detection feature.

								
To top