Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 170 https://internationalpubls.com A Comparative Study of Fuzzy Logic Type-1, Type-2 and Gradient- Based Method for Edge Detection in RGB Images Navita Dhaka1, Dr Meenakshi Hooda2*, Dr Sumeet Gill3, Vinita Yadav4 1,4, Research Scholar, Department of Mathematics, Maharshi Dayanand University Rohtak,124001, Haryana, India 2*Assistant Professor, Department of Mathematics, Maharshi Dayanand University Rohtak,124001, Haryana India 3Professor, Department of Mathematics, Maharshi Dayanand University Rohtak, Haryana India Corresponding Author(2*) – meenakshi.maths@mdurohtak.ac.in Contributing Author(1)- navita.rs.maths@mdurohtak.ac.in Article History: Received: 01-06-2024 Revised: 03-07-2024 Accepted: 29-07-2024 Abstract: Edge detection is widely used in image processing to simplify the images by reducing data. It emphasizes essential features and thereby enhances data processing speed. Edge detection techniques are widely used in the fields of Medical Imaging, Vehicle Detection, Fingerprint Recognition, Robotic vision, Steganography, Feature extraction, security etc. This research paper presents a comparative analysis of different edge detection techniques based on gradient fuzzy Type-1 and fuzzy Type-2. The researcher has experimentally evaluated the edges detected using Prewitt operator based on Gradients, mshEdgeRGB_T1 algorithm based on Fuzzy Type-1 Logic and mshEdgeRGB_T2 algorithm based on Fuzzy Type-2 Logic. The results reveal that edge pixels detected by using algorithms based on Fuzzy Logic are more in comparison to Gradient based Prewitt operator. The paper also shows a comparative analysis of edges detected by algorithms based on Fuzzy Logic for different ranges of membership values of pixels in fuzzy edge set. Keywords: Fuzzy Type-1 Logic, Fuzzy Type-2 Logic, Edge Detection, Prewitt Operator. 1. Introduction Edge detection is crucial in image analysis, playing a key role in fields such as feature extraction, image segmentation and pattern recognition. This makes edge detection a fundamental process in the field of image processing [4]. Edges are the visible lines that separate different objects or textures in an image. They are, where the image changes quickly from one colour or brightness to another. In terms of frequency, edges have higher frequencies compared to other parts of the image [1]. In recent decades, most of the research work focused on edge-detection algorithms for grayscale images. However, colour image processing has gained more attention these days because it provides more detailed information about objects in a scene, enhancing image processing performance. While edge detection in colour images is more complex computationally, it offers significant advantages, such as improved object location accuracy and the ability to process more complex images [2]. Image Edge detection can broadly be categorized into two types i.e. Gradient-based and Gaussian- based edge detectors. Gradient-based edge operators include Canny, Sobel and Prewitt operators, while Gaussian-based edge operators include Laplacian of Gaussian (LOG) operators. The Gradient-based edge detectors calculate first-order derivatives and Gaussian-based edge detectors calculate the second order derivatives of image pixels to find the edges of any digital image [6]. In this paper, we used Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 171 https://internationalpubls.com Gradient-based Prewitt operator for comparison with algorithms based on Fuzzy Type-1 and Fuzzy Type-2 Logic. In a wide range of important applications, edge detection and image segmentation techniques are frequently used. Fuzzy rule-based classifiers have been employed in various tasks, including self- localization and landmark identification, data density estimation, real-time object detection and human activity recognition [7]. In this paper, we evaluate edge detection algorithms based on Fuzzy Type-1 and Fuzzy Type-2 inference systems and show the comparison to analyse that algorithm which detects more edge pixels. The experimental results are compared for PSNR, MSE and energy ratio. Balochain et al. worked on the classical Prewitt Operator, calculating the derivatives along the x and y directions using Fractional Order Derivative (FOD) to improve edge detection capability [1]. In [2], Gonzalez presented a new method of edge detection for colour images, combining fuzzy type-1 and gradient-based edge detection. This proposed method can handle a higher degree of uncertainty in edge detection and provides sharper edges compared to gradient-based edge detectors. Yau Hwang et al. [5] proposed a new fuzzy Sobel method that can detect and enhance the edges of an image by determining threshold values. In this method, the gradient value is still calculated, but the threshold value is replaced according to the fuzzy rule. Wang et al. [8] proposed a fuzzy logic method for edge detection, focusing on different membership values to create a new model for clear image identification. Their experimental results were compared with traditional operators like Canny and Sobel. Zhang et al. [9] proposed a new edge detection technique based on a fuzzy logic system known as adaptive neuro- fuzzy. This technique uses a sharpening Gabor filter to regulate edge quality and a Gaussian filter to reduce noise caused by sharpening. Recently, a new method of edge detection for RGB images was proposed which is based on fuzzy type-1 and Sobel operator Yau Hawng et al. [5]. Motivated by the work done in this field, the present study exploits mshEdgeRGB_T1 and mshEdgeRGB_T2 based on Fuzzy Type-1 and Fuzzy Type-2 Logic respectively and Prewitt operator for comparative analysis of detected edges in RGB images. 2. Methods 2.1 Prewitt operator This operator was introduced by Granzales, Edds and Wood, which is based on a first-order derivative operator. It is also known as a Gradient-based operator whose primary goal in image processing is to detect edges and recognize the shapes within the image [10]. The operator can be applied to all types of images and is particularly effective in detecting sharp edges. The operator used in image processing to find edge pixels, designed to identify areas in an image where the intensity changes sharply, typically indicative of edges. The algorithm approximates the gradient of the image intensity function at each point, highlighting the orientation and strength of edges [11]. Horizontal Convolution Kernel (PX) 1 1 1 0 0 0 -1 -1 -1 The Prewitt operator uses two 3x3 convolution kernels, one for detecting an edge in horizontal direction (PX) and second for vertical direction (Py), which are shown below: Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 172 https://internationalpubls.com Vertical Convolution Kernel (Py) 1 0 -1 1 0 -1 1 0 -1 these masks are applied on a colour image to calculate the change in intensity value of every pixels in both directions. The sum of these masks is zero. When we apply both kernels of an image it works to solve the first-order derivative and calculate the difference between pixel intensities in the edges area. Using PX and Py, we find the gradient magnitude as well as the direction of edge. It is the best method to find the orientation, brightness changes, intensity value, shape and boundaries of any image [12]. 2.2 Fuzzy Type-1 Logic System Fuzzy Type-1 logic is introduced by Professor Lofti Zadeh in the 1960s. Fuzzy Type-1 gives a powerful framework for image processing by incorporating the concept of partial membership, which contrasts with the binary nature of classical sets. In this context, each pixel in an image is assigned a membership value between 0 and 1, reflecting its degree of belonging to different categories such as edges, textures or background. This approach enables more precise and adaptive processing by capturing the inherent vagueness and variations in image data. For instance, in tasks like edge detection, Fuzzy Type-1 sets facilitate the identification of edges that may be blurred or not sharply defined, thereby improving the accuracy of boundary delineation. Their ability to model uncertainty and handle gradual transitions makes Fuzzy Type-1 sets particularly effective in complex image processing applications, leading to enhanced performance and more reliable results in diverse imaging scenarios [5],[7]. 2.3 Fuzzy Type-2 Logic System Fuzzy Type-2 logic proposed by Dr. Jerry Mendel in the late 1990s, extends the capabilities of fuzzy logic in image processing by introducing a higher level of complexity and flexibility through their use of fuzzy membership functions that are themselves fuzzy. This means that rather than having a single membership value for each pixel, Type-2 fuzzy sets incorporate a range of possible membership values, providing a more nuanced representation of uncertainty and ambiguity in image data. This is particularly advantageous in scenarios involving noisy or imperfect images, where the boundaries between different regions are not clearly defined. For example, in image segmentation and edge detection, Fuzzy Type-2 sets can more effectively handle overlapping or indistinct boundaries by modelling the uncertainty inherent in pixel classification. As a result, this approach improves the robustness and accuracy of image processing algorithms, leading to enhanced image analysis and feature extraction performance. The key difference between Fuzzy Type-1 and Fuzzy Type-2 Logic for edge detection lies in their capacity to represent uncertainties within membership functions and their approaches for handling uncertainties within membership functions, which directly impacts the accuracy and complexity of edge detection [3]. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 173 https://internationalpubls.com 3. Experiment and Results This section represents the comparison between Fuzzy Type-1 and Fuzzy Type-2 Logic based edge detection of colour images using mshEdgeRGB_T1 and mshEdgeRGB_T2 algorithms. Research have taken three different colour images (Parrot, Apple and Flower) for experimental results and the algorithms based on Fuzzy Type-1 and Fuzzy Type-2 Logic are implemented using MATLAB software. Fig. 1 shows the edge detected using the Prewitt operator, mshEdgeRGB_T1 and mshEdgeRGB_T2 edge detection algorithms. It shows that mshEdgeRGB_T1 detects more edges than Prewitt operator and mshEdgeRGB_T2 gives sharp edges as compared to other two methods discussed previously. Sr. No. Image Name Original Image Prewitt Operator mshEdgeRGB_T1 mshEdgeRGB_T2 1. Parrot 2. Apple 3. Flower Fig. 1 Edge Detection using Different Edge Detection Methods Fig. 2 gives comparative analysis of edges detected in different image using mshEdgeRGB_T1 and mshEdgeRGB_T2 algorithms for different ranges of degree of membership values. It demonstrates the variations in edges detected for three different images, for membership values ranging from 0.5- 0.9, 0.6-0.9, 0.7-0.9, 0.8-0.9 and 0.9-1.0. This comparative analysis highlights the distinct characteristics of each algorithm. As shown in Fig. 2, mshEdgeRGB_T1 algorithm tends to produce smoother and more continuous edges. The mshEdgeRGB_T2 algorithm gives sharper edges as compared to the results from the mshEdgeRGB_T1 algorithm. Both algorithms are based on the Mamdani fuzzy inference system. To define the crisp values in the fuzzy system for input, these algorithms use the horizontal and vertical differences of pixel intensities of image. For fuzzy inference rules, four rules are applied to determine the degree of membership of pixels in three different fuzzy sets i.e. White, Gray and Black. In defuzzification, the centroid method is used to aggregate all input values and provide a single crisp value. Table 1 demonstrate a comparative analysis between two image processing algorithms, mshEdgeRGB_T1 and mshEdgeRGB_T2, across various membership values (0.5-1.0) for three images: Parrot, Apple, and Flower. Evaluation parameters include Edge Pixels, PSNR (Peak Signal- Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 174 https://internationalpubls.com to-Noise Ratio), MSE (Mean Squared Error), and L2RAT (Energy Ratio). They are used to show the similarity between the edge image using Prewitt, mshEdgeRGB_T1 and mshEdgeRGB_T2 algorithms. These metrics are applied on both edge image obtained from Prewitt operator and Algorithms. At the highest membership value (0.9-1.0), mshEdgeRGB_T2 algorithm gives in lower PSNR value. Similarly, for the Apple and Flower images, mshEdgeRGB_T1 shows better edge detection and higher PSNR, except at the highest membership value where mshEdgeRGB_T2 significantly improves. At high membership value mshEdgeRGB_T2 give sharp edge and low PSNR and high MSE values for all image. When the membership value increases from 0.5-0.9 to 0.9-1.0, the number of edge pixels typically decreases, while PSNR (Peak Signal-to-Noise Ratio) generally improves and MSE (Mean Squared Error) decreases. Image Name Edge Detection Type Different Membership Value 0.5-0.9 0.6-0.9 0.7-0.9 0.8-0.9 0.9-1.0 Parro t mshEdgeRGB_ T1 mshEdgeRGB_ T2 Apple mshEdgeRGB_ T1 mshEdgeRGB_ T2 mshEdgeRGB_ T1 Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 175 https://internationalpubls.com Flowe r mshEdgeRGB_ T2 Fig.2 Comparative Analysis of edges detected using mshEdgeRGB_T1 and mshEdgeRGB_T2 Algorithms for different Membership ranges Table 1 Evaluation Metrics for Varying Membership Values (mshEdgeRGB_T1 and mshEdgeRGB_T2) Sr . N o. Image Name Memb ership Value mshEdgeRGB_T1 mshEdgeRGB_T2 Edge Pixels PSNR Value MSE Value L2RA T Value Edge Pixels PSNR Value MSE Value L2RA T Value 1 Parrot 0.5-0.9 64292 9.384 7492.03 2.685 28451 12.104 4005.28 1.215 0.6-0.9 63554 9.334 7579.72 2.671 27971 12.038 4066.44 1.206 0.7-0.9 60703 9.140 7925.98 2.598 26702 11.842 4254.72 1.174 0.8-0.9 52071 8.963 8255.46 2.303 24571 11.598 4500.27 1.102 0.9-1.0 230502 2.291 38363.40 11.71 266347 1.745 43503.01 13.764 2 Apple 0.5-0.9 36565 8.903 8369.43 2.257 19257 10.754 5464.99 1.248 0.6-0.9 36196 8.849 8474.04 2.246 19142 10.724 5503.40 1.245 0.7-0.9 34199 8.658 8856.30 2.168 18510 10.570 5701.30 1.220 0.8-0.9 27021 8.564 9049.38 1.800 16998 10.359 5985.51 1.142 0.9-1.0 115148 2.475 36776.28 8.863 132456 1.958 41425.70 10.375 3 Flower 0.5-0.9 57632 6.464 14676.63 1.453 39457 7.034 12870.50 1.084 0.6-0.9 56586 6.343 15091.53 1.440 38935 6.960 13094.20 1.077 0.7-0.9 51586 5.924 16619.99 1.356 37340 6.743 13764.50 1.051 0.8-0.9 35457 5.409 18713.22 0.999 33352 6.360 15032.02 0.962 0.9-1.0 52160 4.458 23295.74 1.741 70339 3.828 26930.50 2.369 4. Conclusion In visual image processing, edge detection is an important technique used to identify various parameters within images. It shows discontinuities in color images, which occur due to sudden changes in pixel values, color intensity and noise, helping to define image boundaries. This paper shows a comparative analysis of two algorithms, mshEdgeRGB_T1 and mshEdgeRGB_T2, for detecting edges in RGB images. Both algorithms utilize Mamdani Fuzzy Inference Systems and fuzzy inference rules, examining edge pixels across various membership values and ranges. The results indicate that mshEdgeRGB_T1 is more effective at detecting edge pixels under certain membership values, while mshEdgeRGB_T2 gives sharp edges at some membership values. Additionally, the comparison between edge images obtained from these algorithms and the Prewitt operator shows differences in PSNR, MSE and L2RAT values, highlighting the experimental results among the methods. Future research will further compare these techniques with other edge detection methods, such as Sobel, Canny, and Roberts operators. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 7s (2024) 176 https://internationalpubls.com Declaration of Competing Interest: The authors have not revealed any conflicts of interest related to this work. Acknowledgements: The contributing author recognizes and appreciates the financial aid from the CSIR, under Sanction letter no. 09/382(15462)/2022-EMR-I. References [1] Balochian, S., Baloochian, H. Edge detection on noisy images using Prewitt operator and fractional order differentiation. Multimed Tools Appl 81, 9759–9770 (2022). https://doi.org/10.1007/s11042-022-12011-1. [2] Gonzalez, C. I., Melin, P., & Castillo, O. (2017). Edge detection method based on general type-2 fuzzy logic applied to color images. Information, 8(3), 104. [3] P. Melin, O. Mendoza, and O. Castillo, “An improved method for edge detection based on interval type-2 fuzzy logic,” Expert Syst Appl, vol. 37, no. 12, pp. 8527–8535, 2010, doi: 10.1016/j.eswa.2010.05.023. [4] Selvakumar, P., & Hariganesh, S. (2016). The performance analysis of edge detection algorithms for image processing. 2016 International Conference on Computing Technologies and Intelligent Data Engineering (ICCTIDE’16). doi:10.1109/icctide.2016.7725371 [5] Yau-Hwang Kuo, Chang-Shing Lee, & Chao-Chin Liu. (n.d.). A new fuzzy edge detection method for image enhancement. Proceedings of 6th International Fuzzy Systems Conference. doi:10.1109/fuzzy.1997.622858 [6] Gupta, S., Singh, H., & Singh, Y. J. (2023, February). Comprehensive Study on Edge Detection. In International Conference on Communication, Electronics and Digital Technology (pp. 445-462). Singapore: Springer Nature Singapore. [7] Ranjan, R., & Avasthi, D. V. (2022). Enhanced edge detection technique in digital images using optimised fuzzy operation. Webology, 19(1), 5402-5416. [8] Song, J., Wang, J., & Li, S. (2019). Dynamic Fuzzy Inference System for Edge Detection of Stone Inscriptions. In Proceedings of the 3rd International Conference on Digital Signal Processing, 91-94. [9] Zhang, W., Zhao, Y., Breckon, T.P., & Chen, L. (2017). Noise robust image edge detection based upon the automatic anisotropic Gaussian kernels. Pattern Recognition, 63, 193-205. [10] Abdullah, A. S., Ali, M. H. and Waleed, M. (2022). Distributed Prewitt Edge Detection System Using Lightness of Ycbcr Color Space. Webology, 19(1), 1460-1473. [11] Yang, L., Wu, X., Zhao, D., Li, H. and Zhai, J. (2011, October). An improved Prewitt algorithm for edge detection based on noised image. In 2011 4th International congress on image and signal processing (Vol. 3, pp. 1197-1200). IEEE. [12] Nagasankar, T. and Ankaryarkanni, B. (2016). Performance analysis of edge detection algorithms on various image types. Indian Journal of Science and Technology, 9(21), 1-7. https://doi.org/10.1007/s11042-022-12011-1