Fuzzy Logic Based Edge Detection in Smooth and Noisy Clinical Images

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.


Introduction
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 [1]. Edge detection has numerous applications in the field of robotics [2], medical image analysis [3], geographical science [4], pattern recognition [5], and military technology [6] 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) [7]. It is often the case that these images embody high frequency noise or irrelevant data which inhibits the detection of continuous edge points [8], 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][10][11][12][13][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 [9], Sobel [10], Robert [11], Kirsch [12], Prewitt [13] and LOG [14], 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 [15] 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 [16] 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 [17], ant colony optimization [18], and genetic algorithms with particle swarm optimization [19].
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. [22] 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. [23]. 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][25][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.

Proposed Methodology
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.

Edge Detection
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 Noisy Edge Detection 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.

Window Mask
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, P j 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 ΔP j = |P j − 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 T rz F [29] is expressed as: Where 'r' 's''t',' and u', are the various parameters of trapezoidal MF, and its details are depicted in Fig 4(A).
While the Gaussian MF [30] is expressed as Where 'm' and 'd' are the different parameters of the Gaussian MF and its details are shown in Fig 4(B).

Fuzzy Sets
Each input, 'ΔP j ' 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; nonedge 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 [31]. 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
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 [32]. The calculated output is as following: Where N is the number of quantized RPN conclusions, 'z x ' is the support value at which the 'x th ' MF touches its extreme value (it is considered as the centre of maximum range in case of trapezoidal MFs), 'q x ' is the degree of the truth of the 'x th ' MF, and centre of gravity conclusions is indicated by 'c'.

Contrast Adjustment
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: Where' G 1 ' and 'G 2 ' 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: Where 'Q p ' denotes the maximum possible intensity value of the pixel in the input image. The value of 'Q p ' 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.
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 [15] 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   Table 4 present statistical analysis such as sensitivity and specificity of the proposed technique with Sobel, Canny and scan line approximation [15]. 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 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.