A Case Study: Edge Detection Techniques Using Hough Transform and Canny Edge Algorithm
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Mechanical Engineering and Technology (IJMET) Volume 8, Issue 10, October 2017, pp. 729–740, Article ID: IJMET_08_10_079 Available online at http://iaeme.com/Home/issue/IJMET?Volume=8&Issue=10 ISSN Print: 0976-6340 and ISSN Online: 0976-6359 © IAEME Publication Scopus Indexed A CASE STUDY: EDGE DETECTION TECHNIQUES USING HOUGH TRANSFORM AND CANNY EDGE ALGORITHM Deepika Rani Sona, Prayline Rajabai. C, Debopam Dey, Akanksha Jain School of Electronics Engineering, VIT University, Vellore, Tamil Nadu, India Rashmi Ranjan Das School of Electrical Engineering, VIT University, Vellore, Tamil Nadu, India Stephen Olatunde Olabiyisi Department of Computer Science and Engineering, Ladoke Akintola University of Technology, Ogbomoso, Oyo State, Nigeria ABSTRACT Edge Detection is an ever-expanding frontier in the field of Digital Image Processing. Several research papers have been published in this domain in the past decade specifying many applications of edge detection methods using platforms like MATLAB or OpenCV like Hough, Canny, Sobel, Prewitt Trans- forms among many others. In this case study, various elaborations on basic methods of edge detection have been made and their applications have been discussed in real-time. Furthermore, the performance analysis is figure out by comparison between the results of Canny Edge Detection method and Hough Transforms. Keywords: Edge Detection, Canny Edge Detection Algorithm, Computation Time, Hough Transform, Memory Mapping. Cite this Article: Deepika Rani Sona, Prayline Rajabai. C, Debopam Dey, Akanksha Jain, Rashmi Ranjan Das and Stephen Olatunde Olabiyisi, A Case Study: Edge Detection Techniques Using Hough Transform and Canny Edge Algorithm, International Journal of Mechanical Engineering and Technology 8(10), 2017, pp. 729–740. http://iaeme.com/Home/issue/IJMET?Volume=8&Issue=10 1. INTRODUCTION Paul Hough suggested an efficient method for detecting lines and edges in binary images in 1962 [1]. Hough Transform (hereinafter referred as HT) converts a global detection problem in the image space into an easier local peak detection problem in the parameter space. The working algorithm of HT is explained in fig 1 which uses the slope-intercept parameterization and the voting scheme. http://iaeme.com/Home/journal/IJMET 729 [email protected] Deepika Rani Sona, Prayline Rajabai. C, Debopam Dey, Akanksha Jain, Rashmi Ranjan Das and Stephen Olatunde Olabiyisi 1) Building the parameter space with an appropriate quantization level for any given line of slope m and intercept c. 2) Create an accumulator array denoted as A (m, c). 3) Set A (m, c) = 0 ∀ (m, c) 4) Extract the edge of the images using Canny Detector. 5) For each pixel on the image edges: (xi, yi )∀ (mk , cl ) Verifying equation: cl = −ximk + yi ; Increment: A(mk , cl ) = A(mk , cl ) + 1 6) Find the local maxima A(m, c) and in that indicate the lines in the parameter space. For the above algorithm, all edge pixels lying on a line plays a role in increasing the content of the cell in the accumulator array which corresponds to the real slope and intercept of that line. This suggests that every corresponding straight line does really exist in the image. Thus, we can say that the HT can be considered as a vote-counting-procedure where each edge point votes for all the parameter combinations which could have possibly resulted in its formation. Fig. 1 represents a straight line with slope 1 and intercepts 3 and the corresponding pixel values of the image formed by it. Figure 1 A line in image space is represented as a cell: (m=1, c=3) in parameter (Hough) space. Figure 2 shows various images and cases for point−to−curve transformation. Here, we obtain degenerate solutions when the input is a vertical line or nearly vertical line. Thus, the slope approaches to infinity. This is the stimulus which suggests the (ρ,θ) parameterization in [2]. The parameter ρ is the perpendicular distance from the origin to the line, and the parameter θ is the angle between the perpendicular and the horizontal axis. In fact, this is a point-to-curve transformation using the normal representation of the line: xcosθ +ysinθ =ρ All the edge points are independently treated in HT; which makes the parallel processing of all points possible which leads to its real-time applications. Also, all the partially deformed and noisy shapes can be handled very easily due to its voting scheme. Moreover, the multiple occurrences of lines can be detected very easily since each occurrence has its unique cell address in the parameter space. HT can be extended to detect shapes other than lines. All the above-mentioned points give HT an edge over any other edge detection methods. Figure 2 A point-to-curve transformation in (ρ,θ) parameterization http://iaeme.com/Home/journal/IJMET 730 [email protected] A Case Study: Edge Detection Techniques Using Hough Transform and Canny Edge Algorithm Moreover, the HT has certain drawbacks. It requires a high computational demand and a large storage area. However, it can be increased by reducing the size of the accumulator array. Another edge detection technique is Canny Edge Detection Algorithm (hereinafter referred as CEDA) which was developed by John F. Canny in 1986. According to Canny, an optimal edge detection filter should maximize the product of localization criteria and detection with the restriction in low spurious inputs. The main advantage of canny edge detection method is that the algorithm is adaptable to various environments. Its parameters allow it to be modified to the edges of differing characteristics and figures depending on the requirements from the end user in any given implementation or application. The remaining paper is arranged and organized as follows: Section II gives us the methodology followed by both the edge detection techniques separately. Section III contains the shape detection aspects of any image. Section IV presents the speedup and memory saving techniques in both the algorithm. Section V deals with the experimental results obtained in MATLAB. Section VI focuses on all possible real-time applications. Section VII has the future work related to this article and Section VIII concludes the article. 2. METHODOLOGY Hough Transform Figure 3 shows the architecture of the proposed circle detection algorithm. The algorithm consists of two modules; an edge detector and a voting processor. First, in the edge detector module, we apply the Ball Detection Algorithm [4] to obtain edges from grayscale images. To efficiently handle edges, we utilize double-buffered internal memory blocks to store the edge list (hereinafter referred as EL). Next, for each edge pixel, the voting processor constructs a circular cone, as described in [5], in Hough space with adaptive circular resolution using pre- calculated trigonometric values based on the standard circle Hough transform. Finally, relatively high voter circles are chosen from the circular cone. To minimize the high-cost numerical resources, the proposed edge detector module is mainly implemented based on the ball detection algorithm [4] for background subtraction. The trigonometric function values are indexed by n × dtθ (θ interval in the trigonometric function table), as depicted in Fig4. Since we use eight sample points in a pixel, more than eight V Es for a pixel may not have a good effect on the weight calculation. Thus, dtθ can be adaptively decided by the following equation: Figure 3 Block Diagram of the Edge Detection System http://iaeme.com/Home/journal/IJMET 731 [email protected] Deepika Rani Sona, Prayline Rajabai. C, Debopam Dey, Akanksha Jain, Rashmi Ranjan Das and Stephen Olatunde Olabiyisi 128 푘 = 푟+1 , 푘 ≥ 1 푑푡휃 = { 2| | 2 1, 푘 < 1 k can be calculated by simple shift operators without complex dividers and multiplexers since the dividing and multiplexing operations in the equation are binary operations. Figure 4 Structure of the Voting Procedure [2] Figure 4 shows the architecture of the proposed voting processor. First, the Edge fetch unit reads the edge information from EL and the quad-vectored edge generator modules in the Rasterizer Unit produce vectored edges in parallel using pre- calculated values obtained from the trigonometric table. Thus, each module processes only 128/ (4.dtθ ) times with the range of 0o ∼ 21.8o, 22.5o ∼ 44.3o, 45.0o ∼ 66.8o, and 67.5o89.3o. The coordinate values between 90.0o and 359.3ocan be simply calculated with addition/subtraction operators from the results of the modules because they are all symmetric by the x-axis or y-axis, or both. Next, render modules set the flag bits based on the edge flag algorithm [5]. They then accumulate and calculate the weight value of each pixel as described in [6]. Canny Edge Detection Algorithm Canny Edge Detection is one of the simplest methods used in shape recognition. This method uses 4 stages for edge detection which are mentioned as follows [3]: • Image smoothing • Calculating edge strength and edge direction. • Directional non-maximum suppression. • Invoking threshold with Hysteresis. The output is an image containing only the edges detected through these processes. http://iaeme.com/Home/journal/IJMET 732 [email protected] A Case Study: Edge Detection Techniques Using Hough Transform and Canny Edge Algorithm Figure 5 Steps involved in Canny Edge Detection Algorithm Image smoothing is performed by convolving the input image with a Gaussian filter. This process is used to reduce the noise within an image or to produce a less pixilated image. The output obtained is a blurred intermediate image. This blurred image is input to the next block to calculate the edge strength and direction of the edges. The final output of this stage is a blurred image obtained from the image smoothing stage which is convolved with a 3x3 Sobel operator. The Sobel operators are used to obtain a gradient image.