International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) _______________________________________________________________________________________________ Edge detection using Fuzzy Logic 1 Richa Garg, 2Beant Kaur 1 M. Tech student, 2Assistant Professor, Department of Electronics & Communication, Punjabi University, Patiala Email: 1richapta@gmail.com Abstract :- Edge detection is one of the most important steps in image processing. In fact Image segmentation, registration and identification are also based on edge detection. There are some techniques for edge detection such as Sobel, Preweitt, Laplacian and Laplacian of Gaussian. But it has some limitations like fixed edge thickness and some parameter like threshold is difficult to implement. The fuzzy rule-based technique does not have such limitation, as we can change the edge thickness simply by changing rules and output parameters. This paper presents the edge detection by fuzzy rule based algorithm, which is able to detect edges efficiently from the gray scale images. The proposed method is demonstrated in comparison with the existing sobel edge detector. Keywords — Fuzzy logic, Edge detection, Threshold, Image Processing, Sobel edge detector Fuzzy logic has many unique features that make it a good choice for many control problems. It does not require precise i.e. noise-free inputs and output control is a smooth control function despite a wide range of input variations. Any reasonable number of inputs can be processed and numerous outputs can be generated, Fuzzy logic can control nonlinear systems that would be difficult or impossible to model mathematically. Fuzzy rule structures are easily interpreted by the human beings [2]. C. Edge detection Edge detection is a very important low-level image processing operation, and is used in various higher level tasks such as motion and feature analysis, understanding, recognition and retrieval from databases. [3]. I. INTRODUCTION Fuzzy Image processing is the technique which is used for understanding, representing and processing the images, their segments and features as fuzzy sets [1]. A. Image Processing Image processing is any form of signal processing in which the input is an image, such as a photograph or video frame, the output of image processing may be either an image or a set of characteristics or parameters related to the image. Image processing technique may be Image enhancement, Image restoration and Image compression etc.[1] B. Fuzzy logic Fuzzy logic is a form of many-valued logic. Fuzzy logic variables may have a truth value that ranges in degree between 0 and 1. It aims at modeling the imprecise modes with reasoning that is approximate rather than fixed of reasoning that play an essential role in the remarkable human ability to make rational decisions in an environment of uncertainty and imprecision Edge detection is one of the most important tasks in image processing including segmentation, registration; identification and recognition are based on edge detection algorithm. Most of the edge detection has fixed result such as thickness of edges or some parameters must be selected certainly for good result such as threshold and σ. But the fuzzy logic approach doesn’t have this restricts. Simply, fixing some parameters changes the result of processing. 1. Image gradient: Image gradient is the method which is used to extract information from images. It gives us the information in two pieces. The gradient has a magnitude and direction in which the magnitude tells us how quickly the image is changing and the direction tell us the direction in which the image is changing most rapidly. [4] The gradient of an image is given by the formula: …………(1) _______________________________________________________________________________________________ ISSN (Print): 2319-2526, Volume-3, Issue-3, 2014 20 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) _______________________________________________________________________________________________ where : Ix and Iy are input of image gradient along x-axis and yaxis and Iout is the desired Output. is the gradient in the x direction is the gradient in the y direction. 2. Step 5: Defuzzify the image to get the output. The output is as shown in fig. 4(d). If sobel operator is used then the output image after applying fuzzy rules is as shown in fig. 4(c). Sobel: The Sobel operator performs a 2-D spatial gradient measurement on an image and so emphasizes regions of high spatial frequency that correspond to edges. Typically it is used to find the approximate absolute gradient magnitude at each point in an input grayscale image. The gradient magnitude is given by: ……….(2) Start Input Image convert RGB image to Gray scale image Where Gx and Gy are the sobel gradient along x-axis and y-axis and G is the mean square value. II. PROPOSED METHOD Apply Sobel Edge Detection and obtian the output Give the values of two parameters to the Fuzzy Integral System The Proposed methods which is used for edge detection are in the following steps: Step 1: Input an RGB Image and convert the RGB image to Gray scale image. It is given by Y’ = 0.299R’ + 0.587G’ + 0.114B’ …….(3) Step 2: Obtain the gradient along magnitude and direction for image gradient. If sobel detector is used then sobel algorithm is applied. Now obtain the output of the sobel before applying fuzzy rules as shown in fig. 4(b). Step 3: Define Membership function for the fuzzy inference system. The input 1 , input 2 and output membership is shown in figure 3(a), (b) & (c) resp. Step 4: Define the fuzzy rules to obtain the output image. If else rules is applied as given Define Membership function of inputs and output Define Fuzzy rules for obtaining Image Edges Defuzzification Output Image Stop Fig. 1 Shows the flowchart for the sobel edge detection method before and after applying fuzzy rules If Ix is zero and Iy is zero then Iout is white Else If Ix is not zero or Iy is not zero then Iout is black Where _______________________________________________________________________________________________ ISSN (Print): 2319-2526, Volume-3, Issue-3, 2014 21 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) _______________________________________________________________________________________________ Start Input Image convert RGB image to Gray scale image Obtain image gradient along X-direction and Y-direction (b) Apply these values to the Fuzzy Integral System Define Membership function of inputs and output Define Fuzzy rules for obtaining Image Edges (c) Defuzzification Fig. 3 Membership functions for (a) Ix (b) Iy (c) output III. RESULTS Output Image Stop Fig. 2 Shows the flowchart for edge detection based on fuzzy logic. In this paper, we represent some experimental results of our proposed method. The original image, the result based images on Sobel edge detector before applying fuzzy rules, Sobel edge detector after applying fuzzy rules and Edge detector using Fuzzy logic are as shown in fig. 4. (a) (b) (a) _______________________________________________________________________________________________ ISSN (Print): 2319-2526, Volume-3, Issue-3, 2014 22 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) _______________________________________________________________________________________________ (c) [3] Debashis, Sen; Sankar, K. Pal; “Gradient histogram: Thresholding in a region of interest for edge detection,” Image and Vision Computing, Vol. 28, pp. 677–695, 2010. [4] David Jacobs; “Image Gradients”, Class Notes for CMSC 426, Fall 2005 [5] Thakkar, M.; Shah, H.; “Automatic Thresholding in Edge Detection Using Fuzzy Approach,” Dec 2010, IEEE conference on Computational Intelligence and Computing Research, pp. 1-4 [6] Somasundaram, K.; and Ezhilarasan, K.; “Edge Detection using Fuzzy Logic and Thresholding”, 2012 National conference on signal and image processing, pp. 157 - 160. [7] Patel,D.K.; and Sagar, A. K.; “Edge Detection Technique by Fuzzy Logic and Cellular Learning Automata using Fuzzy Image Processing”, Dec 2013, IEEE conference on computer communication and Informatics, pp. 1 - 6. [8] Kaur, K.; Gill, I.S. and Mutenja, V.; “Fuzzy Logic Based Image Edge Detection Algorithm in MATLAB”, 2010 International journal of computer application, pp. 55 - 59. [9] M. Abdullah-Al-Wadud et al., “A Dynamic Histogram Equalization for Image Contrast Enhancement”, IEEE Trans., Consumer Electronics, vol.53, no. 2, pp. 593–600, May 2007. (d) Fig. 4(a) Original Image (b) Sobel Edge Detection before applying fuzzy rule(c) Sobel Edge Detection after applying Fuzzy rule. (d) Edge Detection using Fuzzy Logic IV. CONCLUSION It has been concluded from the subjective approach that Fuzzy logic based Edge detection gives more accurate result as compared to sobel. REFERENCES [1] [2] Iqbal, J.; mehmood, A.K.; Saadia, T.; Sabahat, z.; “IMPLEMENTING BALL BALANCING BEAM USING DIGITAL IMAGE PROCESSING AND FUZZY LOGIC”, 2005 IEEE, may 2005 canadian conference on electrical and computer engineering, pp. 2241 2244. salinas, R.M.; aguirre, E.; cordon, O.; silvente, M.G “Automatic Tuning of a Fuzzy Visual System Using Evolutionary Algorithms: Single-Objective Versus Multi objective Approaches” April 2008 IEEE Trans. on Fuzzy System, vol.16, no. 2, pp.485-500. _______________________________________________________________________________________________ ISSN (Print): 2319-2526, Volume-3, Issue-3, 2014 23