Edge detection has beneficial applications in the fields such as machine vision, pattern recognition and biomedical imaging etc. Edge detection highlights high frequency components in the image. Edge detection is a challenging task. It becomes more arduous when it comes to noisy images. This study focuses on fuzzy logic based edge detection in smooth and noisy clinical images. The proposed method (in noisy images) employs a 3×3 mask guided by fuzzy rule set. Moreover, in case of smooth clinical images, an extra mask of contrast adjustment is integrated with edge detection mask to intensify the smooth images. The developed method was tested on noise-free, smooth and noisy images. The results were compared with other established edge detection techniques like Sobel, Prewitt, Laplacian of Gaussian (LOG), Roberts and Canny. When the developed edge detection technique was applied to a smooth clinical image of size 270×290 pixels having 24 dB ‘salt and pepper’ noise, it detected very few (22) false edge pixels, compared to Sobel (1931), Prewitt (2741), LOG (3102), Roberts (1451) and Canny (1045) false edge pixels. Therefore it is evident that the developed method offers improved solution to the edge detection problem in smooth and noisy clinical images.
Citation: Haq I, Anwar S, Shah K, Khan MT, Shah SA (2015) Fuzzy Logic Based Edge Detection in Smooth and Noisy Clinical Images. PLoS ONE 10(9): e0138712. https://doi.org/10.1371/journal.pone.0138712
Editor: Jonathan A. Coles, Glasgow University, UNITED KINGDOM
Received: February 13, 2015; Accepted: September 2, 2015; Published: September 25, 2015
Copyright: © 2015 Haq et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Data Availability: All the data underlying the findings described in the manuscript is freely available to other researchers in the body of the manuscript.
Funding: These authors have no support or funding to report.
Competing interests: The authors have declared that no competing interests exist.
Edges in an image are contours generated as a result of sudden or abrupt change in any of the (multiple) characteristics at pixel level. These changes could be observed due to alteration in colour, texture, shade or light absorption. These characteristics could further lead in estimating the orientation, size, depth and surface features in an image . Edge detection has numerous applications in the field of robotics , medical image analysis , geographical science , pattern recognition , and military technology  etc. In medical images the role of edge detection is significant and has extensively been employed for the detection of structures and anomalies in computerized tomography (CT) scans, positron emission tomography (PET) scans and magnetic resonance images (MRI) . It is often the case that these images embody high frequency noise or irrelevant data which inhibits the detection of continuous edge points , since edge itself is a composition of high frequency data. The noise generates false flags as they often mislead the algorithms for an edge.
Many techniques have been employed for the development of an optimum edge detection algorithm [9–14]. Each effort is guided by the motivation to overcome the limitations in previous methodologies. The conventional techniques incorporate the use of linear time invariant filters. These filters recognize an edge as an abrupt change of grey scale pixel intensities. The techniques are well established and computationally efficient. Canny , Sobel , Robert , Kirsch , Prewitt  and LOG , are based on the concept of spatial differential filters utilizing local gradient. These filters process the data in a relatively short time and are computationally optimized, however, they are susceptible to noise.
Jiange and Bunke  proposed an approximation of scan lines method for edge detection. The results achieved were considerably accurate and substantial in comparison to other segmentation techniques. A 5×5 kernel was developed by Genming and Bouzong  for the detection of edges in an image based on a fixed threshold level. However, their limitation was their inadaptability to regions with varying greyscale due to a fixed threshold point. Recent techniques incorporates methods developed for artificial neural networks , ant colony optimization , and genetic algorithms with particle swarm optimization .
Fuzzy Set theory is another technique that has been employed for edge detection [20–21].The method performs mathematical and logical reasoning based on approximations rather than crisp values. Therefore the technique significantly reduces the complexity of problems where fixed values cannot be attained or predicted. Kim et al.  proposed a methodology employing the use of a 3×3 kernel and a look up table. However, the technique could not adapt to challenging tests as it required manual tuning and configuration for each test. Sixteen fuzzy rules were defined for edge detection in a study conducted by Kaur et al. . The results for edge detection were appreciable in images (with no noise) but performed poorly when noise was introduced. Further studies have been conducted in higher form of fuzzy logic especially fuzzy type-2 to accommodate greater uncertainties [24–26]. A theoretical perception suggests that higher order fuzzy rules set would compensate other limitations and effectively represent uncertainties. Unfortunately, the complexity of representation of model in fuzzy type-2 increases multi-folds.
To address these concerns this study is to develop a methodology that is able to detect edges effectively in smooth and noisy clinical images. Our technique employs a 3×3 mask guided by fuzzy rule set for edge detection in noisy images. Moreover, for smooth clinical images an extra mask of contrast adjustment is integrated with the edge detection mask based on fuzzy logic to intensify the smooth images. A robust filter was achieved as a result which is convenient to apply (invariant to noise and achieves optimal results).
The remaining article is organized in the following sections. Section 2 presents the developed methodology for edge detection followed by simulation results and discussion in section 3. Finally conclusions are drawn in section 4.
The Lady Reading Hospital (LRH) Peshawar, Pakistan medical staff explain the Magnetic Resonance Imaging (MRI) procedure to the patient. Subsequently, verbal consent was acquired (from the patient) prior to the MRI, and this was documented and added to the patient record. The data employed in this study provided by the LRH was completely anonymous and unidentified. Since the data is unidentified therefore the ethics committee of the LRH approved the study protocol and the method of consent.
The proposed edge detection algorithm for noisy and clinical images is based on a fuzzy inference system. A two mask technique was used to detect edges in greyscale images. For detection of edges in noisy images only one mask (edge detection mask) was used. However, for smooth clinical images an extra mask of contrast adjustment was integrated with the edge detection mask to intensify the image based on fuzzy logic. The workflow of the proposed methodology is shown in Fig 1.
The developed edge detection technique for noisy images is based on fuzzy logic. A 3x3 window mask was designed to take the greyscale values of neighborhood pixels from the input image. The greyscale values of the neighborhood pixels obtained from the mask were pre-processed prior to the fuzzy inference system. A fuzzy inference system was designed to take the processed values as an input. These values were subsequently converted into the fuzzy plane. A fuzzy rule base was defined to determine and show the edge pixels’ in the output image. The output of the system was calculated by the centroid method and defuzzification was performed based on Mamdani inference. The block diagram of the proposed fuzzy edge detection is shown in Fig 2.
A 3x3 window mask was designed for scanning the image, in the proposed approach as shown in Fig 3(A). The mask took the greyscale values, Pj of eight neighborhood pixels with the central pixel, P as the out pixel. The greyscale values obtained from the mask were pre-processed. Fig 3(B) shows the processed mask, where ΔPj = |Pj − P| for j = 1, 2, 3… 8.
Fuzzy membership functions
In fuzzy inference system, membership functions (MFs) play a key role. In the fuzzy set, fuzziness is measured using MFs as they are the key constituents of the fuzzy set theory. The type and shape of the MF should carefully be selected as they have effects on the fuzzy inference system. Trapezoidal MFs were used for the input data, because they exhibit reasonably improved results in comparison to other MFs [27–28]. Whereas, Gaussian MFs were used for the output data, because they are smooth and non-zero at all points. The standard trapezoidal membership function TrzF  is expressed as: (1)
Where ‘r’ ‘s’‘t’,’ and u’, are the various parameters of trapezoidal MF, and its details are depicted in Fig 4(A).
Each input, ‘ΔPj’ to fuzzy inference system was divided into two fuzzy sets; lower and higher. The output (pixel), ‘P’ from the fuzzy inference system was divided into two fuzzy sets; non-edge and edge. The associated MFs with the input and output fuzzy set are shown in s Figs 5 and 6, respectively.
Table 1 lists the various terminologies and parameters of both the input and output fuzzy sets.
Fuzzy Knowledge Base
Fuzzy knowledge base or rule base in fuzzy inference system is a set of linguistic descriptions . Fuzzy rule base plays a key role in fuzzy inference system as it makes conclusions related to either classifying an input or stabilizing and adjusting the output. Fuzzy rule base for the proposed edge detection algorithm consists of the following linguistic descriptions as listed in Table 2.
De-fuzzification is the final step involved in fuzzy inference system and is a significant as fuzzification of data set. The membership degrees corresponding to input parameters were attained through fuzzy rule sets and membership functions (MFs). This fuzzy information was quantified into numerical data in this step. There are multiple techniques available for de-fuzzification such as middle of maximum (MOM), center of area (COA), weighted fuzzy mean (WFM), random choice of maximum (RCOM), indexed center of gravity (ICOG), and centre of gravity (COG) etc. Our method employs centroid de-fuzzification (COD), since COD is one of the most accurate, effective and efficient in its applications . The calculated output is as following: (3)
Where N is the number of quantized RPN conclusions, ‘zx’ is the support value at which the ‘xth’ MF touches its extreme value (it is considered as the centre of maximum range in case of trapezoidal MFs), ‘qx’ is the degree of the truth of the ‘xth’ MF, and centre of gravity conclusions is indicated by ‘c’.
Contrast adjustment was performed before edge detection in the smooth grey (color) clinical images in order to enhance and intensify the edge pixels. The proposed contrast adjustment was based on fuzzy logic. The corresponding MFs for input data (pixels) and output pixels are shown in Fig 7.
The fuzzy rule base for the proposed contrast adjustment is summarized in Table 3.
Simulation Results and Discussion
The developed edge detection technique was tested on a number of greyscale images including noise free, noisy and smooth images. For noise free and noisy images, only one mask (Edge detection) was employed. However, for smooth clinical images contrast adjustment mask was collectively used, with edge detection mask.
In noise free greyscale images, the developed technique has successfully detected all type of edges as shown in Fig 8. The greyscale rainbow image of size 314x192 pixels having five different regions covered by six boundary lines is shown in Fig 8(A). The proposed technique for edge detection have detected these six boundary lines (edges) successfully as shown in Fig 8(D). Similarly, the proposed method has successfully detected edges in the greyscale (flower) images as shown in Fig 8E & 8F.
The developed edge detection technique has the advantage of detecting edges in the noisy images as previously discussed (in the introduction). This was verified by detecting edges in an image having 25 dB ‘salt and pepper’ noise. To compute the noise level in an image through peak signal to noise ratio (PSNR) [33–34], the mean square error (MSE) was first computed as: (4)
Where’ G1’ and ‘G2’ represents the input noise free and noisy images respectively. While 'm' and 'n' indicates the total number of rows and columns of the input images respectively. Finally the expression for the computation of noise level becomes as following: (5)
Where ‘Qp’ denotes the maximum possible intensity value of the pixel in the input image. The value of ‘Qp’ for eight bit unsigned integer data type image is 255.
The developed edge detection technique was applied to an image of size 512x512 pixels having ‘salt and pepper’ noise at a level of 25dB. The simulation results are compared with other conventional and reported edge detection algorithms as shown in Fig 9. From the experimental results it is clear that the proposed fuzzy based edge detection algorithm has detected a very few false edge pixels in comparison to the other reported edge detection techniques. The Canny method results were encouraging for this experiment.
All the experimentation was performed on image b.
The number of false edge pixels detected by different reported edge detection techniques is shown in Fig 10. It is evident in Fig 10, that the developed edge detection technique when subject to a noisy image of 512x512 size and 25 dB noise level has detected 202 false edge pixels, while other edge detection techniques for instance, Sobel, Prewitt, LOG, Roberts, Canny, previously developed fuzzy logic and scan line approximation  based technique, after fine tuning canny method gives few false edge pixels.
One of the advantages of the proposed edge detection technique is that it could detect edges in smooth clinical images as well. Fig 11 shows the experimental results of the propose algorithm when applied to smooth clinical MRI images. It is evident in Fig 11 that the developed algorithm has successfully detected edges in the smooth clinical images.
Finally the developed edge detection technique was applied to the smooth clinical image of size 270x290 pixels having 24 dB ‘salt and pepper’ noise. The experimental results were compared with other conventional edge detection techniques like Sobel, Prewitt, LOG, Roberts, Canny and scan line approximation based technique  as shown in Fig 12.
It is clear from results that the developed technique shows excellent results compared to the established edge detection techniques. The number of false edge pixels detected by various edge detection techniques, when subject to images having different PSNR values is shown in Fig 13. It obvious that from Fig 13 that the number of false edge pixels detected by various techniques increases as we increase the noise level in the images. Furthermore, it is clear from Fig 13 that the developed technique when (subjected to image having 24 dB PSNR), has detected very few false edge pixels (22) in comparison to the other established edge detection techniques like Sobel (1931), Prewitt (2741), LOG (3102), Roberts (1451), Canny (1045) and scan line approximation based technique  (225). Further, Table 4 present statistical analysis such as sensitivity and specificity of the proposed technique with Sobel, Canny and scan line approximation . It is evident from the table that proposed technique has higher value for sensitivity and specificity among the previously established techniques. The proposed technique has potential applications in many disciplines ranging from medical (MRI images, bones defects/cracks) to industrial (surface inspection, crack detection, rust detection) and in agriculture (identification of deforestation, crop yield production, identification of nutritional deficiencies).
Conclusion and Future Work
This paper proposes and demonstrates a fuzzy logic based edge detection algorithm for smooth and noisy images. The developed technique employs a 3×3 mask guided by fuzzy rule set for edge detection in noisy images. Furthermore, for smooth clinical images an extra mask of contrast adjustment is integrated with the edge detection mask based on fuzzy logic to intensify the smooth images. The developed technique has successfully detected all the edge pixels in noise free, noisy and smooth images. The developed algorithm is also compared with other conventional and previously developed fuzzy logic based edge detection techniques. The developed edge detection algorithm when subjected to a 512 x 512 size greyscale image having 25 dB ‘salt and pepper’ noise has detected very few false edge pixels (202), while the reported edge detection techniques like Sobel, Prewitt, LOG, Roberts, Canny and previously developed fuzzy logic have detected 6673, 9395, 1241, 4792, 172 and 5362 respectively. When the developed technique was applied to a smooth clinical image of 270 x 290 size having 24 dB ‘salt and pepper’ noise, it detected 22 false edge pixels, while the reported edge detection techniques like Sobel, Prewitt, LOG, Roberts and Canny have respectively detected 1931, 2741, 3102, 1451 and 1045 false edge pixels.It is obvious from the experimental results that in case of smooth and noisy images the developed technique provides better results.
In future work, an investigation on how to incorporate Artificial Immune System and Genetic algorithm with fuzzy logic to develop a hybrid technique for edge detection is under consideration.
Conceived and designed the experiments: SA IH. Performed the experiments: IH SA. Analyzed the data: SA MTK. Contributed reagents/materials/analysis tools: SAS KS. Wrote the paper: IH SA. Paper revision and addressing reviewers' comments: IH SA.
- 1. Torre V, Poggio TA. On Edge Detection. Pattern Analysis and Machine Intelligence, IEEE Transactions on. 1986;8(2):147–163.
- 2. Bruno S, Lorenzo S, Luigi V, Giuseppe O. Robotics: Modelling, Planning and Control: Springer-Verlag London; 2008.
- 3. Chucherd S. Edge detection of medical image processing using vector field analysis. Computer Science and Software Engineering (JCSSE), 2014 11th International Joint Conference on; 2014 14–16 May; Chon Buri, Thailand. IEEE. p. 58–63.
- 4. Lin H, Du P-j, Zhao C-s, Shu N. Edge detection method of remote sensing images based on mathematical morphology of multi-structure elements. Chinese Geographical Science. 2004;14(3):263–268.
- 5. Rulaningtyas R, Ain K. Edge detection for brain tumor pattern recognition. Instrumentation, Communications, Information Technology, and Biomedical Engineering (ICICI-BME), 2009 International Conference on; 2009 Nov 23–25; Bandung, Indonesia. IEEE. p. 1–3.
- 6. Goshtasby AA. 2-D and 3-D Image Registration: for Medical, Remote Sensing, and Industrial Applications: Wiley-Interscience; 2005.
- 7. Loft A, Jensen KE, Lofggren J, Daugaard Sr, Petersen MM. PET/MRI for Preoperative Planning in Patients with Soft Tissue Sarcoma: A Technical Report of Two Patients. Case Reports in Medicine. 2013;2013
- 8. Setayesh M, Mengjie Z, Johnston M. Effects of static and dynamic topologies in Particle Swarm Optimisation for edge detection in noisy images. Evolutionary Computation (CEC), 2012 IEEE Congress on; 2012 June 10–15; Brisbane, Australia. IEEE. p. 1–8.
- 9. Canny J. A Computational Approach to Edge Detection. Pattern Analysis and Machine Intelligence, IEEE Transactions on. 1986;8(6):679–698.
- 10. Zhang J-Y, Chen Y, Huang X-x. Edge detection of images based on improved Sobel operator and genetic algorithms. Image Analysis and Signal Processing, 2009 IASP 2009 International Conference on; 2009 April 11–12; Taizhou, China. IEEE. p. 31–35.
- 11. Rosenfeld A. The Max Roberts Operator is a Hueckel-Type Edge Detector. Pattern Analysis and Machine Intelligence, IEEE Transactions on. 1981;3(1):101–103.
- 12. Kirsch RA. Computer determination of the constituent structure of biological images. Computers and Biomedical Research. 1971;4(3):315–328. pmid:5562571
- 13. Lei Y, Dewei Z, Xiaoyu W, Hui L, Jun Z. An improved Prewitt algorithm for edge detection based on noised image. Image and Signal Processing (CISP), 2011 4th International Congress on; 2011 Oct. 15–17; Shanghai, China. IEEE. p. 1197–1200.
- 14. Ulupinar F, Medioni Gr. Refining edges detected by a LoG operator. Computer Vision, Graphics, and Image Processing. 1990;51(3):275–298.
- 15. Jiang X, Bunke H. Edge Detection in Range Images Based on Scan Line Approximation. Computer Vision and Image Understanding. 1999;73(2):183–199.
- 16. Genming C, Baozong Y. A new edge detector with thinning and noise resisting abilities. Journal of Electronics (China). 1989;6(4):314–319.
- 17. Naumenko A, Lukin V, Egiazarian K. SAR-image edge detection using artificial neural network. Mathematical Methods in Electromagnetic Theory (MMET), 2012 International Conference on; 2012 Aug. 28–30; Kyiv, Ukraine. IEEE. p. 508–512.
- 18. Verma OP, Sharma R. An optimal edge detection using universal law of gravity and ant colony algorithm. Information and Communication Technologies (WICT), 2011 World Congress on; 2011 Dec. 11–14; Mumbai, India. IEEE. p. 507–511.
- 19. Setayesh M, Zhang M, Johnston M. Effects of static and dynamic topologies in particle swarm optimisation for edge detection in noisy images. Evolutionary Computation (CEC), 2012 IEEE Congress on; 2012 June 10–15; Brisbane, Australia. IEEE. p. 1–8.
- 20. Yau-Hwang K, Chang-Shing L, Chao-Chin L. A new fuzzy edge detection method for image enhancement. Fuzzy Systems, 1997, Proceedings of the Sixth IEEE International Conference on; 1997 1997 Jul 1–5; Barcelona, Spain. IEEE. p. 1069–1074.
- 21. El-Khamy SE, Lotfy M, El-Yamany N. A modified fuzzy Sobel edge detector. Radio Science Conference, 2000 17th NRSC; 2000 Feb. 22–24; Minufiya, Egypt. IEEE. p. C32/1—C32/9.
- 22. Kim D-S, Lee W-H, Kweon I-S. Automatic edge detection using 3 x 3 ideal binary pixel patterns and fuzzy-based edge thresholding. Pattern Recognition Letters. 2004;25(1):101–106.
- 23. Kaur EK, Mutenja V, Gill EIS. Fuzzy logic based image edge detection algorithm in MATLAB. International Journal of Computer Applications. 2010;1(22):55–58.
- 24. Chen SM, Chang YC, Pan JS. Fuzzy Rules Interpolation for Sparse Fuzzy Rule-Based Systems Based on Interval Type-2 Gaussian Fuzzy Sets and Genetic Algorithms. Fuzzy Systems, IEEE Transactions on. 2013;21(3):412–425.
- 25. Chia-Hung H, Chia-Feng J. Evolutionary Robot Wall-Following Control Using Type-2 Fuzzy Controller With Species-DE-Activated Continuous ACO. Fuzzy Systems, IEEE Transactions on. 2013;21(1):100–112.
- 26. Zhou H, Ying H. A Method for Deriving the Analytical Structure of a Broad Class of Typical Interval Type-2 Mamdani Fuzzy Controllers. Fuzzy Systems, IEEE Transactions on. 2013;21(3):447–458.
- 27. Monicka JG, Sekhar NG, Kumar KR. Performance evaluation of membership functions on fuzzy logic controlled ac voltage controller for speed control of induction motor drive. International Journal of Computer Applications. 2011;13(5):8–12.
- 28. Botzheim J, Haimori B, Koczy LT. Extracting Trapezoidal Membership Functions of a Fuzzy Rule System by Bacterial Algorithm. Computational Intelligence Theory and Applications. 2206: Springer Berlin Heidelberg; 2001. pp. 218–227.
- 29. Banerjee S, Roy TK. Arithmetic operations on generalized trapezoidal fuzzy number and its applications. Turkish Journal of Fuzzy Systems. 2012;3(1):16–44.
- 30. Reddy CS, Raju K. An improved fuzzy approach for COCOMO’s effort estimation using gaussian membership function. Journal of Software. 2009;4(5): p. 452–459.
- 31. Subbaram Naidu D. Soft computing and intelligent systems design: theory, tools and applications, F. O. Karry and C. De Silva, Pearson, Addison-Wesley, New York, NY, 2004. International Journal of Robust and Nonlinear Control. 2006;16(11):548–551.
- 32. Leekwijck WV, Kerre EE. Defuzzification: criteria and classification. Fuzzy Sets and Systems. 1999;108(2):159–178.
- 33. Luisier F, Blu T, Unser M. Image denoising in mixed Poisson–Gaussian noise. Image Processing, IEEE Transactions on. 2011;20(3):696–708.
- 34. Liu J, Huan Z, Huang H. Image restoration under mixed noise using globally convex segmentation. Journal of Visual Communication and Image Representation. 2011;22(3):263–270.