Performance and Analysis of Edge detection using FPGA
Implementation R. Ponneela Vignesh Assistant Professor,Dept of ECE,Tamilnadu College of Engineering Coimbatore,Tamilnadu.
Abstract II. Canny edge detection algorithm
Edge detection serves as a pre-processing step for The Canny edge detection algorithm is known to many as many image processing algorithms such as image the optimal edge detector. The first and most obvious is low enhancement, image segmentation, tracking and image/video error rate. It is the important that edges occurring in images coding. The edge detection is one of the key stages in image should not be missed and that there are no responses to non- processing and object recognition. This paper present a edges. The second criterion is that the edge points be well Canny edge detection algorithm that results in significantly localized. A third criterion is to have only one response to a reduced memory requirements, decreased latency and single edge. increased throughput with no loss in edge detection This was implemented because the first two were performance. This edge detection algorithm is based on not substantial enough to completely eliminate the possibility MATLAB simulation and FPGA implementation. of multiple responses to an edge. Based on these criteria, the canny edge detector first smoothes the image to eliminate Keywords: Canny edge detector, MATLAB and FPGA and noise. It then finds the image gradient to highlight regions with high spatial derivatives After the edge directions I. Introduction are known, non maximum suppression now has to be applied Edge detection is a basic operation in image processing, it Non-maximum suppression is used to trace along the edge in refers to the process identifying and locating sharp the edge direction and suppress any pixel value that is not discontinuities in an image, the discontinuities are abrupt considered to be an edge. This will give a thin line in the changes in pixel intensity which characterize boundaries of output image. objects in a scene. It is a very important first step in many The algorithm then tracks along these regions and algorithms used for segmentation, tracking and object suppresses any pixel that is not at the maximum (non recognition [1]. maximum suppression). The gradient array is now further There are an extremely large number of edge reduced by hysteresis. Hysteresis is used to track along the detection operators available, each designed to be sensitive to remaining pixels that have not been suppressed Hysteresis edges, typically it reduces the memory size and the uses two thresholds and if the magnitude is below the first computation cost[2] the edge detection algorithms are threshold, it is set to zero (made a non edge). To avoid this implemented using software, with advance in very large scale hysteresis uses 2 thresholds, a high and a low. If the integration(VLSI) technology, their hardware magnitude is above the high threshold, it is made an edge. implementation become an attractive alternative, especially This model was based on a step edge corrupted by additive for real-time applications, Many edge detection algorithms white Gaussian noise. Canny edge detection developed an such as Robert detector, Prewitt detector, Kirsch detector, approach to derive an optimal edge detector based on three Gauss-Laplace detector and Canny edge detector have been criteria related to the detection performance. The Canny edge proposed[3], among these algorithms has be widely used in detection algorithm block diagram is shown in below. the field of image processing because of its good performance[3]. It operates on two rows of pixels at a time this reduces the memory requirement at the expense of a decrease in the throughput [2]. In order to reduce memory requirements, decrease latency and increased throughput is proposed in [1]. An absolute different mask edge detection algorithm and its pipelined VLSI architecture for real-time application. But the edge detector in offers a trade-off between precision, cost and speed, and its capability to detect edges is not as good as the Canny algorithm [4]. Fig 1 : Block of Canny edge detection In this paper, a method based on non-uniform and coarse quantization of the gradient magnitude histogram is The Canny edge detection algorithm consists of the proposed. In addition, the proposed algorithm is mapped onto following steps: reconfigurable hardware architecture. The original Canny Calculating the horizontal gradient and vertical edge detection algorithm computes the high and low gradient at each pixel location by convolving the thresholds for edge detection based on the entire image image with partial derivatives of a 2D Gaussian statistics which prevents the processing on individual block function. independently.
www.ijmer.com 552 | Page
International Journal of Modern Engineering Research (IJMER) www.ijmer.com Vol.2, Issue.2, Mar-Apr 2016 pp-552-554 ISSN: 2249-6645 Smoothing the input image by Gaussian mask. The set as an edge pixel. If a pixel has a value above the low output smoothed the image. threshold and is the neighbour of an edge pixel, it is set as an Computing the gradient magnitude and direction at edge pixel as well. If a pixel has a value above the low each pixel location. threshold but is not the neighbour of an edge pixel, it is not Applying non-maximum suppression (NMS) to thin set as an edge pixel. If a pixel has a value below the low edge. threshold, it is never set as an edge pixel. Computing the hysteresis high and low thresholds First the edge detection algorithm is implemented based on the histogram of the magnitudes of the by applying a Gaussian filter on the whole image. Then the gradients of the entire image. processed image data are used as the input to calculate the gradient at each pixel level and these gradient values are used Performing hysteresis thresholding to determine the edge map. to calculate the direction and the magnitude at a certain pixel. The low pass filtering is achieved by taking the average pixel values.
It can be shown that convolving an image with a
symmetric 2D Gaussian and then differentiating in the direction of the gradient forms simple and effective directional operator, which meets the three criteria mentioned above Suppose the G(x, y) is a 2D Gaussian and I(x, y) is the image, then the smoothed image H(x, y) as Fig 2 : Design flow of Canny edge detection H(x, y) = G(x, y) * I(x, y) In order to implement the Canny edge detector Where the H(x, y) is denoted as horizontal gradient, the G(x, algorithm, some steps must be followed. The following steps y) is denoted as gradient magnitude and I(x, y) as smoothed are executed sequentially: image. The first step is to filter out any noise in the original The data obtains usually contains some spurious image before trying to locate and detect any edges. responses in the non maximal suppression (NMS). This is The Gaussian filter mask is used exclusively in Canny called the streaking problem and is quite common in the edge edge detection algorithm. detection problem. These streaking can be eliminated by The Gaussian smoothing can be performed using using a threshold with hysteresis. standard convolution methods. a convolution mask is much smaller than the actual image The Canny edge detector will be carried out in The larger width is the Gaussian mask and the following four steps: lower is the detector sensitivity. 1. Image smoothing The localization error in the detected edges also 2. Gradient calculation and directional Non-Maximum increases slightly as the Gaussian width is increased. suppression The Gaussian in implementation is shown below. 3. Calculating thresholds 4. Thresholding with hysteresis.
1. Smooth the image with a two dimensional Gaussian. In
most cases the computation of a two dimensional Gaussian is costly, so it is approximated by two one dimensional Gaussians, one in the x direction and the other in the y direction. 2. Take the gradient of the image. This shows changes in intensity, which indicates the presence of edges. This actually gives two results, the gradient in the x direction and the gradient in the y direction. 3. Non-maximal suppression. Edges will occur at points the where the gradient is at a maximum. Therefore, all points not at a maximum should be suppressed. In order to do this, the magnitude and direction of the gradient is Fig 3: Discrete approximation to Gaussian function computed at each pixel. Then for each pixel check if the The second step is to find the edge strength by magnitude of the gradient is greater at one pixel's taking the gradient of the image. distance away in either the positive or the negative Then, the approximate absolute gradient magnitude direction perpendicular to the gradient. If the pixel is not (edge strength) at each point can be found. greater than both, suppress it. It uses a pair of 3x3 convolution masks, one 4. Edge Thresholding. The method of thresholding estimating the gradient in the x-direction (columns). used by the Canny Edge Detector is referred to as The other convolution masks estimating the gradient "hysteresis". It makes use of both a high threshold and a low in the y-direction (rows). They are shown below: threshold. If a pixel has a value above the high threshold, it is www.ijmer.com 553 | Page International Journal of Modern Engineering Research (IJMER) www.ijmer.com Vol.2, Issue.2, Mar-Apr 2016 pp-552-554 ISSN: 2249-6645 CONCLUSION The result of the image can be obtained by using MATLAB.Thus compared to other edge detection algorithm, Canny edge detection algorithm use probability for finding error rate localization and response in various images. Thus even blurred image and images with noise can be detected accurately using this Canny edge detection algorithm as there The magnitude or edge strength of gradient is then is a specification of improving signal to noise ratio. It results approximated using the formula: in a significant speedup and successfully detects the edges of the images. |G| = |Gx| + |Gy| FUTURE WORK The direction of the edge is computed using the gradient in the x and y directions. Whenever the gradient in the x Thus as a future enhancement, the implementation of Canny direction is equal to zero, the edge direction has to be equal edge detection algorithm can be perform on FPGA platform to 90 degrees or 0 degrees, Formula for finding edge and tested in system C. Thus tested in system C which can direction: overcome the major disadvantage of canny edge detection algorithm of complex computation and time consuming. It is -1 capable of supporting fast real time edge detection for images θ = tan (Gy / Gx) and videos. If GY has a value of zero, the edge direction will equal to 0 degrees. Otherwise the edge direction is equal to 90 degrees. REFERENCES [1] S. Varadarajan, C. Chakrabarti, L. J. Karam, and J. III Simulation results M.Bauza, “A distributed psycho-visually motivated The algorithm performance was tested using a variety of Canny edge detector,” IEEE ICASSP, pp.882-825, images. The simulations results are obtained in MATLAB. Mar.2010. Here the results are tested by two images. [2] D. V. Rao and M. Venkatesan, “An efficient reconfigurable architecture and implementation of (a). Finger print and edge detection algorithm using Handle-C,” ITCC, vol. 2, pp. 843 – 847, Apr. 2004. (b). Eye [3] W. He and K. Yuan, “An improved Canny edge detector and its realization on FPGA,” WCICA, pp. Simulation output: 6561 –6564, Jun. 2008. [4] F. M. Alzahrani and T. Chen, “A real-time edge detector algorithm and VLSI architecture,” Real-Time Imaging, vol. 3, no. 5, pp. 363 – 78, 1997. [5] J.F. Canny, “A computation approach to edge detection,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 8, no.6, pp. 769-798, Nov 1986. [6] D. Marr and E. Hildreth, ”Theory of edge Detection,” Proc. Royal Soc. of London, series B, vol. 207, pp. 187-217, 1980. [7] D. Demigny, and T. Kamle,” A discrete expression of Canny’s criteria for step edge detector performances evaluation”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 19(6), pp. 1199-1211, 1997. Fig 4: Matlab simulation result for Finger print image [8] L. Torres, M. Robert, E. Bourennane, and M. Paindavoine, “Implementation of a recursive real time edgedetector using retiming techniques,” VLSI, pp. 811 –816, Aug. 1995.