# Edge Detection via Edge-Strength Estimation Using Fuzzy Reasoning and Optimal Threshold Selection Using Particle Swarm Optimization

Authors: Ajay Khunteta; D. Ghosh
Journal: Advances in Fuzzy Systems
 (2014)

---

## Abstract

An edge is a set of connected pixels lying on the boundary between two regions in an image that differs in pixel intensity. Accordingly, several gradient-based edge detectors have been developed that are based on measuring local changes in gray value; a pixel is declared to be an edge pixel if the change is significant. However, the minimum value of intensity change that may be considered to be significant remains a question. Therefore, it makes sense to calculate the edge-strength at every pixel on the basis of the intensity gradient at that pixel point. This edge-strength gives a measure of the potentiality of a pixel to be an edge pixel. In this paper, we propose to use a set of fuzzy rules to estimate the edge-strength. This is followed by selecting a threshold; only pixels having edge-strength above the threshold are considered to be edge pixels. This threshold is selected such that the overall probability of error in identifying edge pixels, that is, the sum of the probability of misdetection and the probability of false alarm, is minimum. This minimization is achieved via particle swarm optimization (PSO). Experimental results demonstrate the effectiveness of our proposed edge detection method over some other standard gradient-based methods.


---

## Body

## 1. Introduction

Edge detection is an essential and important first step in object identification. An edge may be defined as a set of connected pixels lying at the boundary between the foreground and the background. Therefore, edge detection algorithms generally rely on detecting discontinuities within an image. Several gradient-based edge detectors are available in the literature which are based on measuring local changes in gray value; a pixel is declared to be an edge pixel if the change is significant. Accordingly, the underlying principle in most edge detection techniques is to compute the first- or second-order derivative of the intensity function within the image-detectors based on the first derivative looks for points where the derivative value is large while those using the second-order derivative find edges at zero-crossings of the image [1]. Several gradient operators, such as the Roberts, Prewitt, Sobel, and the Laplacian masks, exist which are used to estimate the first- and the second-order derivatives [2]. However, these detectors are generally very sensitive to noise and hence perform poorly in case of noisy images. In [3], Canny proposed a method to counter this noise problem by convolving the image with the first-order derivatives of Gaussian filter prior to edge detection. Some other edge detectors that incorporate linear filtering, local orientation analysis, fitting of analytical models, and local energy are available in the literature [4–7].However, the operators mentioned above are referred to as “noncontextual” or general edge detectors since they do not make any distinction between edges originating from textured regions and object boundaries. “Contextual” edge detectors, on the other hand, selectively detect contours (object boundaries) that are of interest in the context of a specific computer vision task by taking into account additional information around an edge, such as local image statistics, image topology, perceptual differences in texture, and edge continuity. Contour detectors are mainly divided into local and global operators. Local detectors are mainly based on differential analysis, statistical approaches, phase congruency, rank-order filters, and their combinations. The latter class of detectors include computation of contour saliency, perceptual grouping, relaxation labeling, and active contours. The behavior of edges in the scale space has also been critically studied and evaluated [8]. Natural images generally contain edges with different levels of blurring. Further, the human visual system perceives different frequency ranges differently. Accordingly, multiresolution analysis finds importance in contour detection. Multiresolution contour detection may be classified into edge focusing and position-dependent blurring. Edge focusing can achieve both high noise rejection and good edge localization but at the cost of increased computational cost. Position-dependent blurring, on the other hand, is a better option for images that contain different degrees of blurring. Inspired by the surround suppression mechanism exhibited by the human visual system, contour detection methods using model for surround suppression via receptive field inhibition have also been developed [9–11]. The operator responds strongly to isolated lines and edges, region boundaries, and object contours, while suppressing texture edges. This yields better discrimination between object contours and texture edges, thereby improving contour detection performance. A comprehensive review on the various approaches to contour detection that have been developed in the past two decades is available in [12].Gradient-based method for edge detection faces the challenge of edge localization in images that exhibit smooth transition in gray level. This is due to the ambiguous nature of the edge structures in such images. Also, since no absolute ground truth for the gradient threshold is available, clear demarcation between the pixels with high local intensity gradient (edge pixels) and those with low intensity gradient (non-edge pixels) does not exist. To deal with this ambiguity and vagueness in edge structures, some researchers used fuzzy logic theory in defining edges, as summarized below.


### 1.1. Fuzzy-Based Edge Detection

Fuzzy logic plays key role in situation of ambiguity. This motivated researchers to employ fuzzy reasoning for edge detection. The earliest and the most typical fuzzy-based edge detection method is due to Pal and King [13] which used fuzzy based logic as a contrast intensifier to detect edges in X-ray image. This was followed by a series of works in the last three decades, [14–27] to name a few.The method presented by Tao et al. in [14] is based on a set of sixteen fuzzy IF-THEN rules. All these rules are combined to generate a set of potential edge pixels. This method avoids the difficulty of selecting parameter values present in most other edge detectors. Russo and Ramponi used FIRE operator (set of fuzzy inference rules) to detect edges from noiseless as well as noisy images [15]. In [16], Russo used 3 × 3 window-based filtering followed by fuzzy reasoning to detect edges in the presence of noise. A fuzzy classifier was used by Liang and Looney [17] to classify image pixels corresponding to gray level variation in various directions by using a 3 × 3 mask. They used an extended Epanechnikov function as fuzzy set membership function for each class. The class assigned to each pixel is the one with the highest fuzzy membership. A fuzzy-based approach to edge detection in gray-level images is proposed in [18]. This fuzzy edge detector involves two phases: global contrast intensification and local fuzzy edge detection. In the first phase, a modified Gaussian membership function is chosen to represent each pixel in the fuzzy plane. This requires use of some parameters to enhance the image which are obtained by optimizing an entropy function. Rakesh et al. [19] proposed an edge detector in which thresholding is performed using statistical principles. Local standardization of threshold for each individual pixel, depending on the statistical variability of the gradient vector at that pixel, is taken into account for image binarization. In [20], Mendoza et al. applied Sobel operator on a digital gray-scale image and calculated the intensity gradients at each pixel position. This measure of intensity gradient gives the probability of occurrence of an edge. High pass and low pass filter masks are used to detect object boundaries in low contrast region. Finally, type-2 fuzzy inference is used to detect edges. Edge detection in blurry images was carried out by Wu et al. in [21]. For this, contrast of blurry image is first enhanced by means of fast multilevel fuzzy enhancement (FMFE) algorithm and then edges are extracted from the enhanced image by two-stage edge detection operator that identifies the edge candidates based on the local characteristics of the image. A novel edge detector based on fuzzy IF-THEN inference rules to model edge continuity criteria was proposed in [22]. Eight masks are used to get the gradient information. The maximum entropy principle is used for adjusting the parameter values and finally a set of fuzzy rules is used to decide edge pixels. Yang modified the classical Pal and King algorithm with a new fuzzy membership function [23]. To make the algorithm adaptive, membership function is defined automatically from the threshold of the image. In another paper [24], Madasu and Vasikarla proposed fuzzy edge detection in biometric systems. In this approach, edge detection is carried out by means of global (histogram of gray levels) and local (pixels within a window) information. The local information is fuzzified by employing a modified Gaussian membership function. Alshennawy and Aly proposed a method in [25] that is based on fuzzy logic reasoning for edge detection in digital images without determining the threshold value. The proposed approach begins by segmenting the images into regions using floating 3 × 3 binary matrix and finally the edge pixels are mapped to a range of values distinct from each other. An adaptive neurofuzzy inference system (ANFIS) for edge detection in digital images was used by Zhang et al. in [26]. The internal parameters of the proposed ANFIS edge detector are optimized by training with the help of very simple artificial images. The algorithm uses 81 rules and four 3 × 3 masks to detect edges in four directions. In [27], Melin et al. used morphological gradient and fuzzy logic to detect edges and an interval type-2 fuzzy inference system (IT2FIS) are used for improving the edge detection.


### 1.2. Edge Detection Using Evolutionary Algorithms

Nature-inspired evolutionary algorithms like PSO, bacterial foraging algorithm (BFA), ant colony optimization (ACO), genetic algorithm (GA), and so forth have recently been also applied in solving many complex problems including edge detection. A GA-based edge detection technique for texture image was proposed as early as in 1997 [28]. In this method, the edge detection problem is formulated as a combinatorial optimization problem and detection of the edge is executed according to the variance of texture feature in the local area. The candidate edge regions are selected first and then GA is applied in order to decide the optimum edge regions. A novel approach for edge detection based on the theory of universal gravity was presented in [29]. The algorithm assumes that each image pixel is a celestial body with a mass represented by its gray-scale intensity. Accordingly, each celestial body exerts force onto its neighboring pixels and in return receives force from the neighboring pixels. These forces can be calculated by the law of universal gravity. The vector sum of all gravitational forces along the horizontal and the vertical directions is used to compute the magnitude and the direction of signal variation. Edges are characterized by high magnitude of gravitational forces along a particular direction and can therefore be detected. Edge detection based on the fusion of fuzzy heuristic and PSO has been developed in [30]. Edge detection using ant colony optimization and adaptive thresholding was proposed in [31]. Ant colony is used to obtain well-connected edge-map. Ant movements are guided by local variation in intensity values. A novel edge detection technique that combines BFA with probabilistic derivative was proposed by Verma et al. in [32]. In this approach, the direction of movement of the bacteria decided by probability matrix is computed using derivatives along the possible edge directions. To deal with noisy images, this method is modified in [33] by using fuzzy derivative in place of probabilistic derivative. A reliable and accurate method of edge detection via tuning of parameters in BFA-based optimization has also been proposed recently in [34].


### 1.3. Objective of the Paper

In gradient-based image edge detection, thresholding is always a point of concern. Performance of classical edge detectors is very much dependent on the value of threshold chosen. This makes the use of these edge detectors relying on heuristic value manually selected by the user. However, proper choice of the threshold is necessary for selective detection of “contextual” edges that generally form object contours and region boundaries while leaving out “noncontextual” textured edges. Accordingly, in our work, we aim at developing user independent automatic method for determining the optimal threshold value such that only the object contours and region boundaries, which are relevant to object recognition, shape analysis, and image segmentation point of view, are detected.Recently, we proposed a novel edge detection technique that uses a combination of fuzzy reasoning as well as threshold optimization for the purpose of edge detection [35]. The proposed method starts with intensity gradient calculation, similar to other gradient-based edge detectors. Following this, unlike conventional gradient-based edge detectors, we use a set of fuzzy rules to measure the possibility of a pixel to be an edge pixel rather than taking a hard decision at this stage. We refer to this measure as “edge-strength.” Edge-strength at every pixel point is estimated using a fuzzy rule-based inference mechanism. Pixels are subsequently classified as edge or non-edge pixels on the basis of an optimal edge-strength threshold. This optimal threshold is calculated such that the overall probability of error in edge detection is minimized. We propose to employ particle swarm optimization (PSO) [36] technique for the purpose of minimization wherein the objective function is the sum of the probability of misdetection and the probability of false alarm. The purpose of using PSO for minimization is that it is relatively simple metaheuristic algorithm that is easy to implement and capable of dealing with complex search spaces where only minimum knowledge is available. PSO provides relatively fast convergence to the global minimization through a heuristic search within a search space consisting of infinite search points. In this paper, we describe our earlier proposed edge detection algorithm in more details. This is presented in Sections 2 and 3. Our proposed method for edge-strength calculation using fuzzy rules is described in Section 2 while our proposed optimal threshold selection procedure is given in Section 3. In Section 4, we compared our proposed method with some other previously reported methods of edge-detection. Finally, we draw our conclusion in Section 5.


## 1.1. Fuzzy-Based Edge Detection

Fuzzy logic plays key role in situation of ambiguity. This motivated researchers to employ fuzzy reasoning for edge detection. The earliest and the most typical fuzzy-based edge detection method is due to Pal and King [13] which used fuzzy based logic as a contrast intensifier to detect edges in X-ray image. This was followed by a series of works in the last three decades, [14–27] to name a few.The method presented by Tao et al. in [14] is based on a set of sixteen fuzzy IF-THEN rules. All these rules are combined to generate a set of potential edge pixels. This method avoids the difficulty of selecting parameter values present in most other edge detectors. Russo and Ramponi used FIRE operator (set of fuzzy inference rules) to detect edges from noiseless as well as noisy images [15]. In [16], Russo used 3 × 3 window-based filtering followed by fuzzy reasoning to detect edges in the presence of noise. A fuzzy classifier was used by Liang and Looney [17] to classify image pixels corresponding to gray level variation in various directions by using a 3 × 3 mask. They used an extended Epanechnikov function as fuzzy set membership function for each class. The class assigned to each pixel is the one with the highest fuzzy membership. A fuzzy-based approach to edge detection in gray-level images is proposed in [18]. This fuzzy edge detector involves two phases: global contrast intensification and local fuzzy edge detection. In the first phase, a modified Gaussian membership function is chosen to represent each pixel in the fuzzy plane. This requires use of some parameters to enhance the image which are obtained by optimizing an entropy function. Rakesh et al. [19] proposed an edge detector in which thresholding is performed using statistical principles. Local standardization of threshold for each individual pixel, depending on the statistical variability of the gradient vector at that pixel, is taken into account for image binarization. In [20], Mendoza et al. applied Sobel operator on a digital gray-scale image and calculated the intensity gradients at each pixel position. This measure of intensity gradient gives the probability of occurrence of an edge. High pass and low pass filter masks are used to detect object boundaries in low contrast region. Finally, type-2 fuzzy inference is used to detect edges. Edge detection in blurry images was carried out by Wu et al. in [21]. For this, contrast of blurry image is first enhanced by means of fast multilevel fuzzy enhancement (FMFE) algorithm and then edges are extracted from the enhanced image by two-stage edge detection operator that identifies the edge candidates based on the local characteristics of the image. A novel edge detector based on fuzzy IF-THEN inference rules to model edge continuity criteria was proposed in [22]. Eight masks are used to get the gradient information. The maximum entropy principle is used for adjusting the parameter values and finally a set of fuzzy rules is used to decide edge pixels. Yang modified the classical Pal and King algorithm with a new fuzzy membership function [23]. To make the algorithm adaptive, membership function is defined automatically from the threshold of the image. In another paper [24], Madasu and Vasikarla proposed fuzzy edge detection in biometric systems. In this approach, edge detection is carried out by means of global (histogram of gray levels) and local (pixels within a window) information. The local information is fuzzified by employing a modified Gaussian membership function. Alshennawy and Aly proposed a method in [25] that is based on fuzzy logic reasoning for edge detection in digital images without determining the threshold value. The proposed approach begins by segmenting the images into regions using floating 3 × 3 binary matrix and finally the edge pixels are mapped to a range of values distinct from each other. An adaptive neurofuzzy inference system (ANFIS) for edge detection in digital images was used by Zhang et al. in [26]. The internal parameters of the proposed ANFIS edge detector are optimized by training with the help of very simple artificial images. The algorithm uses 81 rules and four 3 × 3 masks to detect edges in four directions. In [27], Melin et al. used morphological gradient and fuzzy logic to detect edges and an interval type-2 fuzzy inference system (IT2FIS) are used for improving the edge detection.


## 1.2. Edge Detection Using Evolutionary Algorithms

Nature-inspired evolutionary algorithms like PSO, bacterial foraging algorithm (BFA), ant colony optimization (ACO), genetic algorithm (GA), and so forth have recently been also applied in solving many complex problems including edge detection. A GA-based edge detection technique for texture image was proposed as early as in 1997 [28]. In this method, the edge detection problem is formulated as a combinatorial optimization problem and detection of the edge is executed according to the variance of texture feature in the local area. The candidate edge regions are selected first and then GA is applied in order to decide the optimum edge regions. A novel approach for edge detection based on the theory of universal gravity was presented in [29]. The algorithm assumes that each image pixel is a celestial body with a mass represented by its gray-scale intensity. Accordingly, each celestial body exerts force onto its neighboring pixels and in return receives force from the neighboring pixels. These forces can be calculated by the law of universal gravity. The vector sum of all gravitational forces along the horizontal and the vertical directions is used to compute the magnitude and the direction of signal variation. Edges are characterized by high magnitude of gravitational forces along a particular direction and can therefore be detected. Edge detection based on the fusion of fuzzy heuristic and PSO has been developed in [30]. Edge detection using ant colony optimization and adaptive thresholding was proposed in [31]. Ant colony is used to obtain well-connected edge-map. Ant movements are guided by local variation in intensity values. A novel edge detection technique that combines BFA with probabilistic derivative was proposed by Verma et al. in [32]. In this approach, the direction of movement of the bacteria decided by probability matrix is computed using derivatives along the possible edge directions. To deal with noisy images, this method is modified in [33] by using fuzzy derivative in place of probabilistic derivative. A reliable and accurate method of edge detection via tuning of parameters in BFA-based optimization has also been proposed recently in [34].


## 1.3. Objective of the Paper

In gradient-based image edge detection, thresholding is always a point of concern. Performance of classical edge detectors is very much dependent on the value of threshold chosen. This makes the use of these edge detectors relying on heuristic value manually selected by the user. However, proper choice of the threshold is necessary for selective detection of “contextual” edges that generally form object contours and region boundaries while leaving out “noncontextual” textured edges. Accordingly, in our work, we aim at developing user independent automatic method for determining the optimal threshold value such that only the object contours and region boundaries, which are relevant to object recognition, shape analysis, and image segmentation point of view, are detected.Recently, we proposed a novel edge detection technique that uses a combination of fuzzy reasoning as well as threshold optimization for the purpose of edge detection [35]. The proposed method starts with intensity gradient calculation, similar to other gradient-based edge detectors. Following this, unlike conventional gradient-based edge detectors, we use a set of fuzzy rules to measure the possibility of a pixel to be an edge pixel rather than taking a hard decision at this stage. We refer to this measure as “edge-strength.” Edge-strength at every pixel point is estimated using a fuzzy rule-based inference mechanism. Pixels are subsequently classified as edge or non-edge pixels on the basis of an optimal edge-strength threshold. This optimal threshold is calculated such that the overall probability of error in edge detection is minimized. We propose to employ particle swarm optimization (PSO) [36] technique for the purpose of minimization wherein the objective function is the sum of the probability of misdetection and the probability of false alarm. The purpose of using PSO for minimization is that it is relatively simple metaheuristic algorithm that is easy to implement and capable of dealing with complex search spaces where only minimum knowledge is available. PSO provides relatively fast convergence to the global minimization through a heuristic search within a search space consisting of infinite search points. In this paper, we describe our earlier proposed edge detection algorithm in more details. This is presented in Sections 2 and 3. Our proposed method for edge-strength calculation using fuzzy rules is described in Section 2 while our proposed optimal threshold selection procedure is given in Section 3. In Section 4, we compared our proposed method with some other previously reported methods of edge-detection. Finally, we draw our conclusion in Section 5.


## 2. Proposed Fuzzy Rule-Based Edge-Strength Calculation

The underlying principle behind gradient-based edge detection is to calculate the intensity gradient at every pixel point in the image and then labeling those pixels as edge pixels where the intensity gradient ishigh. Therefore, it is necessary to define a criterion for decidinghigh andlow intensity gradients. In our proposed method, gradient at each image pixel is calculated by any available gradient operator following which a set of fuzzy rules is used to decide whether the edge-strength at a pixel point is low, medium, or high. This way an edge-strength map of the complete image is obtained.We propose to use fuzzy theory for estimating theedge-strength at every pixel point in the input image. In our proposed approach, we first calculate the intensity gradients Gx and Gy along the horizontal and vertical directions, respectively, at every pixel (x,y) in the image. Next, we determine the edge-strength at that pixel point using several fuzzy rules. A fuzzy inference system that uses these fuzzy rules gives a measure of the edge-strength which is subsequently fuzzified to assess the extent to which the pixel relates to a true edge in the image.In our proposed method for edge detection, we first determine the edge-strength so that edges can be detected appropriately. For this, we propose to use some “IF… THEN …” fuzzy rules and estimate the edge-strength using a fuzzy rule-based inference mechanism. A fuzzy rule typically includes a group of “antecedent clauses” which define conditions and a “consequent clause” which defines the corresponding output action and/or conclusion. These fuzzy rules give directives much similar to human-like reasoning. Such a rule, which is expressed in plain linguistic form, is translated into the more formal structure of a fuzzy operator.As said above, edge pixels are identified by measuring local change in intensity followed by thresholding. The change in intensity may be measured by taking the first derivative of the image function. The derivative quantifies the rate of change in the intensity and hence yields high values at points of rapid transition. In continuous domain, the rate of change of a 2D image intensity functionf(x,y) is given by the gradient vector, defined as
(1)∇f=∂f∂x∂f∂y=GxGy,
where Gx and Gy denote the rate of intensity change along the horizontal (x-axis) and vertical (y-axis) directions, respectively. The magnitude of the gradient vector ∇f, referred to asgradient, gives the measure of the rate of change in intensity at the pixel location (x,y). This is calculated as
(2)Gx,y=Gx2+Gy2=∂f∂x2+∂f∂y2.
To reduce the computational burden, the gradient is sometimes approximated as
(3)Gx,y=Gx+Gy.However, the degree of edginess or edge-strength at a pixel point is to some extent a subjective issue that may not be necessarily quantified in terms ofGx and Gy, as in (2) and (3) above. On the other hand, the edge-strength at a point is in every way related to the rate of change in intensity at that point. That means the degree of edge-strength at a pixel point may be estimated on the basis of combined Gx and Gy information. This may be accomplished using fuzzy reasoning and fuzzy inferencing, the way similar to the human reasoning.In discrete domain, as in case of digital images, it is a common practice to use the first difference in place of the first-order partial derivative. Accordingly, the digital gradients are generally computed using gradient operators consisting of two masks: one mask for computing the horizontal gradientGx and the other for computing the vertical gradient Gy. Several gradient operators, such as the Roberts, Prewitt, and Sobel masks, are available in the literature for that purpose [2]. In our method, we propose to use any such gradient operator for computing the gradients Gx and Gy at a point (x,y) in the image. These two gradient values are then combined to determine the edge-strength at that point using fuzzy reasoning. Thus, our proposed approach differs from the conventional gradient-based edge detectors. Our proposed method for edge-strength calculation uses deductive fuzzy inference system based on a set of four fuzzy rules, as stated below.(i)
Rule1. IF Gx is low AND Gy is low THEN edge-strength E(x,y) is low.(ii)
Rule2. IF Gx is low AND Gy is high THEN edge-strength E(x,y) is medium.(iii)
Rule3. IF Gx is high AND Gy is low THEN edge-strength E(x,y) is medium.(iv)
Rule4. IF Gx is high AND Gy is high THEN edge-strength E(x,y) is high.Thus, our fuzzy system is a two-input and one-output system: two input variables (antecedent clauses) are the two gradients Gx and Gy, and the resultant output variable (consequent clause) is the normalized edge-strength E(x,y), at pixel position (x,y) in the image. These four IF-THEN rules include two conditions (antecedent clauses) about the input variables and specify a consequent clause related to the output variable. Antecedent clauses are linked by fuzzy AND operator. Each clause is completely defined by the shape and position of a fuzzy set, which maps the corresponding variable to the real interval [0,1]. Since the two input variables Gx and Gy are measures of the same quantity (intensity gradient) differing only in their directions of measure (horizontal and vertical directions), they may be defined by the same set of fuzzy sets. Two fuzzy sets for the antecedents and three fuzzy sets for the consequent are used, as represented in Figures 1 and 2. Fuzzy sets for the antecedents are labeled as “low gradient” and “high gradient.” Fuzzy sets for the consequent are “low edge-strength,” “medium edge-strength,” and “high edge-strength.”Figure 1
Membership function plots for fuzzy sets corresponding to low and high intensity gradient (normalized).Figure 2
Membership function plots for fuzzy sets corresponding to low, medium, and high edge-strength.The above stated fuzzy rules are combined using Mamdani’s max-min inference method followed by centroid-based defuzzification. A detailed description of the inference mechanism can be found in [37]. Thus, the “edge-strength” E(x,y) is calculated on the basis of the extent of horizontal and vertical intensity gradients at pixel location (x,y) in the input image.


## 3. Edge-Strength Threshold Selection

After deriving the information regarding edge-strength of an image, as discussed above, now the question is how to decide the threshold value automatically to differentiate edge pixels from non-edge pixels in the image. This implies that the choice of threshold is very important in detecting edge pixels—higher value of threshold may result in misdetection while lower value of threshold may result in false detection. In other words, the performance of any gradient-based edge detector depends on the choice of threshold.The edge-strength calculation step described above maps the input image to a gray-scale edge-map—the gray value at every pixel location corresponds to the edge-strength of that pixel, that is, how much likely is that pixel to be an edge, measured in the range from 0 to 1. However, a binary edge-map is generally desired which shows whether a pixel is an edge or not an edge. So, following the above edge-strength calculation step, a decision making step is necessary through which the pixels in the edge-map are classified into two categories, namely, “edge pixel” and “non-edge pixel.” Thus, the problem at hand essentially boils down to image binarization via 2-class pattern classification that involves selection of an appropriate decision boundary (threshold). Several methods of an optimal threshold for image binarization have been reported in the literature and discussed below.


### 3.1. Methods for Threshold Selection for Image Binarization and/or Edge Detection

Thresholding is a commonly used technique in image segmentation and binarization. Selecting the correct threshold is a critical issue—lower value of threshold increases false alarm while higher value of threshold increases the probability of misdetection. Accordingly, many researchers attempted to address this issue by devising techniques for selection of optimal threshold. One such early attempt in this direction by entropic thresholding was proposed by Pun [38]. Kapur et al. [39] also attempted automatic thresholding using entropy of the histogram for gray level images. In [40], a method for automatically selecting threshold is presented which uses a model based on the weighted sum of two gamma density functions corresponding to edge and non-edge pixels. A robust automatic threshold selection algorithm was introduced in [41] which is based on the average of the gray levels of the pixels in an image weighted by the response of a specific edge detector at each pixel. A technique of three-level thresholding based on probability partition and fuzzy 3-partition has been presented in [42] in which a relationship between a probability partition and a fuzzy partition in thresholding is given. This relationship and the entropy approach are used to derive a thresholding technique to select the best fuzzy partition. In [43], El-Khamy et al. considered the problem of fuzzy edge detection as a two-level thresholding problem where the goal is to partition the image domain according to the gradient value into two fuzzy partitions (regions). These two regions relate to pixels that acquire low local gradient value (smooth region) and pixels that acquire high local gradient value (edge region). Using the relation of the probability partition and the fuzzy 2-partition of the image gradient, the best gradient threshold is selected via minimization of fuzzy entropy. An automatic threshold selection method was proposed in [44] which considers both statistical and spatial correspondence between detected edge points. Local thresholds are adaptively selected in [45] taking into account the activity masking characteristic of the human visual system. The selected local thresholds are then utilized for edge labeling in the gradient image. An adaptive thresholding-based edge detection method using morphological operators is presented in [46]. A double-threshold image binarization method based on the edge detector was proposed in [47] which is based on the edge and intensity information. Image binarization is done in two stages using high and low threshold values. Zhang et al. presented fuzzy edge detection based on Gauss function and automatic selection of threshold parameter by maximum variance [48]. Li and Gao [49] proposed an edge detection algorithm that is based on fuzzy 2-partition entropy approach. The authors addressed the problem of detecting the edge pixels in gray-level image by maximum fuzzy 2-partition entropy principle. Entropy function used to justify that the information of an image is mostly retained after thresholding. Another entropy-based flexible thresholding algorithm was proposed in [50]. Three different methods for adaptive thresholding using fuzzy approach, statistical parameters, and fuzzy reasoning were proposed in [51].


### 3.2. Proposed Method for Optimal Edge-Strength Threshold Selection

In our work, we propose using Bayes decision theoretic approach for optimal threshold selection so as to minimize the overall error in categorizing the pixels into “edge pixels” and “non-edge pixels.” Error occurs when an actual edge pixel is categorized as “non-edge pixel” (misdetection) or vice versa (false alarm).According to Bayes decision rule [52], a pixel at location (x,y) with edge-strength E is marked as an edge pixel if
(4)Pedge∣E>Pno_edge∣E,
where Pedge∣E and Pno_edge∣E denote the conditional probabilities that the pixel is an edge or not an edge, respectively. It follows that the decision boundary (threshold) between non-edge and edge pixels is given by the edge-strength value E for which
(5)Pedge∣E=Pno_edge∣E.
Therefore, the task now is to seek for suitable functions defining the conditional probabilities Pedge∣E and Pno_edge∣E such that the overall probability of classification error is minimized. Once these two probability functions are obtained, the required threshold is automatically established.In connection to the above stated task of finding suitable probability functions, we note the following.(i)
Since a pixel can only be either an edge pixel with some probability or not an edge pixel, these two events are mutually exclusive and form the total probability space. Therefore, we will have(6)Pedge∣E+Pno_edge∣E=1,orPedge∣E=1-Pno_edge∣E.(ii)
Since the edge-strength is the measure of the possibility of a pixel to be an edge pixel, it is intuitively desired that the probabilityPedge∣E be a monotonically non-decreasing function of the edge-strength measure E. It follows that Pno_edge∣E will be a monotonically non-increasing function of E.(iii)
The demarcation between “non-edge” and “edge” is generally fuzzy. This may be well characterized by defining a range of edge-strength valueE, say, E1,E2, corresponding to pixels of such ambiguous nature. In other words, pixels with edge-strength value in this range will have non-zero probability of being both an edge pixel and non-edge pixel; that is,
(7)0<Pno_edge∣E<1,0<Pedge∣E<1forE1<E<E2.(iv)
Based on the preceding observation, a pixel is definitely an edge pixel if its edge-strength exceedsE2. On the other hand, pixels with edge-strength less than E1 are definitely non-edge pixels. Accordingly, we will have
(8)Pno_edge∣E=1for0≤E≤E1,Pedge∣E=1forE2≤E≤1.


#### 3.2.1. Fuzzy Two-Partition of Normalized Image Edge-Strength

Following the above discussion, we propose two trapezoidal functions definingPno_edge∣E and Pedge∣E, as depicted in Figure 3. The reason for this particular choice is its simplicity due to the linear nature of the functions in the intervals from E1 to E2. Nevertheless, some other complex functions represented by higher-order curves in the range E1,E2 may also be used, as per the will of the user.Figure 3
Trapezoidal functions representing the conditional probabilities for a pixel to be “edge” or “not edge,” given edge-strengthE of the pixel.The trapezoidal functions so chosen are completely defined when the values ofE1 and E2 are known. The required decision threshold is then obtained as
(9)Eth=12E1+E2.
Pixels with edge-strength value above Eth will be marked as edge pixels while those with edge-strength less than Eth will be classified as non-edges.Thus, the problem of optimal threshold selection now reduces to the problem of finding a pair of suitable values forE1 and E2 such that the overall error in identifying edge pixels is minimized. Error occurs when an actual edge pixel is not detected (misdetection) or when an actual non-edge pixel is marked as an edge pixel (false alarm). The probability of misdetection is given as
(10)PMD=∫0Eth‍Pedge∣EpEdE,PMD=∫0E1‍Pedge∣EpEdE+∫E1Eth‍Pedge∣EpEdE,PMD=∫E1Eth‍Pedge∣Ep(E)dE(∵Pedge∣E=0for0≤E≤E1)
and the probability of false alarm is calculated as
(11)PFA=∫Eth1Pno_edge∣Ep(E)dE,PFA=∫EthE2Pno_edge∣Ep(E)dE+∫E21Pno_edge∣Ep(E)dE,PFA=∫EthE2‍Pno_edge∣Ep(E)dE(∵Pno_edge∣E=0forE2≤E≤1),
where p(E) is the probability density function of the edge-strength E. The overall probability of error in detecting edge pixels in an image is the sum of the above two probabilities. That is,
(12)Perror=PMD+PFA.


#### 3.2.2. Defining Objective Function

In our proposed work, the overall probability of error is used as the objective function, that is, to be minimized in determining the values ofE1 and E2. It is to be noted that although the edge-strength E is a continuous random variable in the range from 0 to 1, in practice we obtain only a finite number of discrete edge-strength values in this range from a finite-sized image having finite number of pixels. In view of this, the above objective function needs to be expressed in its discrete version, given as
(13)Perror=∑k=E1Eth‍(k-E1)(E2-E1)nkN+∑l=EthE2‍(E2-l)(E2-E1)nlN,
where nk denotes the number of pixels having edge-strength equal to k and N is the total number of pixels in the image. The summation in the first term is over all available discrete edge-strength values in the range of E1 to Eth. Similarly, the summation in the second term is over all discrete edge-strength values in the range of Eth to E2.As discussed above, the aim now is to search for the values ofE1 and E2 that minimize Perror; the search space for the same is illustrated in Figure 4. It may be noted that any point on the line E1=E2 yields Perror=0 and hence corresponds to a trivial solution. Therefore, in order to avoid this trivial solution, the line corresponding to E1=E2 is excluded from the search space.Figure 4
Search space for optimization to determine the values ofE1 and E2.The search space mentioned above consists of an infinite number of search points. Therefore, an exhaustive search is not feasible. In view of this, we propose using particle swarm optimization (PSO) [36]. It is a metaheuristic search procedure that has the capability of escaping from local minima and converging to the global minimum. PSO is simple, fast, and relatively stable from convergence point of view. This makes PSO a popular choice for carrying out the optimization operation in this particular situation.


#### 3.2.3. Objective Function Optimization Using PSO

Now as expressed in (13), thresholding can be achieved by optimizing the given function and obtaining the values of E1 and E2. The steps of the algorithm for minimization of Perror using PSO are as follows.(1)
Set PSO parameters, namely, population size, maximum generation number, and inertia weight.(2)
Set a swarm within the search space. The position of every swarm particle in the search space is given by a pair ofE1 and E2 values.(3)
CalculatePerror for every swarm particle corresponding to its position.(4)
Assign initialpbest and gbest values for this swarm; pbest “personal best” refers to the best position of a swarm particle till now and gbest “global best” is the position of the particle having minimum Perror in the whole swarm.(5)
Run PSO to modify velocity and position of every particle in the swarm using the following equations:(14)vi(t+1)=ωvi(t)+c1r1[pbesti(t)-xi(t)]+c2r2gbestit-xit,xit+1=xit+vit+1,whereω is some predefined inertia weight, c1 and c2 are positive constants, r1 and r2 are random numbers between [0,1], xi(t) is the position of the ith particle at time t, and vi(t) is the velocity of the ith particle at time t. Generally, a large value of the inertia weight ω is desired for global convergence. Note that the location of a particle is restricted at the boundary of the search space if its new position is outside the search space.(6)
CalculatePerror for every swarm particle at its new position. The particle is retained at its new position if its recent Perror value is less than its previous value; else the particle is moved back to its earlier location.(7)
Updatepbest and gbest values in the swarm.(8)
Repeat for maximum number of PSO generations. The final solution is given by thegbest obtained in the final step of iteration.Thus, theE1 and E2 pair of values corresponding to the final solution in the search space is the desired result. The required optimal threshold is now calculated using (9) and then applied to obtain the final edge-map image.


## 3.1. Methods for Threshold Selection for Image Binarization and/or Edge Detection

Thresholding is a commonly used technique in image segmentation and binarization. Selecting the correct threshold is a critical issue—lower value of threshold increases false alarm while higher value of threshold increases the probability of misdetection. Accordingly, many researchers attempted to address this issue by devising techniques for selection of optimal threshold. One such early attempt in this direction by entropic thresholding was proposed by Pun [38]. Kapur et al. [39] also attempted automatic thresholding using entropy of the histogram for gray level images. In [40], a method for automatically selecting threshold is presented which uses a model based on the weighted sum of two gamma density functions corresponding to edge and non-edge pixels. A robust automatic threshold selection algorithm was introduced in [41] which is based on the average of the gray levels of the pixels in an image weighted by the response of a specific edge detector at each pixel. A technique of three-level thresholding based on probability partition and fuzzy 3-partition has been presented in [42] in which a relationship between a probability partition and a fuzzy partition in thresholding is given. This relationship and the entropy approach are used to derive a thresholding technique to select the best fuzzy partition. In [43], El-Khamy et al. considered the problem of fuzzy edge detection as a two-level thresholding problem where the goal is to partition the image domain according to the gradient value into two fuzzy partitions (regions). These two regions relate to pixels that acquire low local gradient value (smooth region) and pixels that acquire high local gradient value (edge region). Using the relation of the probability partition and the fuzzy 2-partition of the image gradient, the best gradient threshold is selected via minimization of fuzzy entropy. An automatic threshold selection method was proposed in [44] which considers both statistical and spatial correspondence between detected edge points. Local thresholds are adaptively selected in [45] taking into account the activity masking characteristic of the human visual system. The selected local thresholds are then utilized for edge labeling in the gradient image. An adaptive thresholding-based edge detection method using morphological operators is presented in [46]. A double-threshold image binarization method based on the edge detector was proposed in [47] which is based on the edge and intensity information. Image binarization is done in two stages using high and low threshold values. Zhang et al. presented fuzzy edge detection based on Gauss function and automatic selection of threshold parameter by maximum variance [48]. Li and Gao [49] proposed an edge detection algorithm that is based on fuzzy 2-partition entropy approach. The authors addressed the problem of detecting the edge pixels in gray-level image by maximum fuzzy 2-partition entropy principle. Entropy function used to justify that the information of an image is mostly retained after thresholding. Another entropy-based flexible thresholding algorithm was proposed in [50]. Three different methods for adaptive thresholding using fuzzy approach, statistical parameters, and fuzzy reasoning were proposed in [51].


## 3.2. Proposed Method for Optimal Edge-Strength Threshold Selection

In our work, we propose using Bayes decision theoretic approach for optimal threshold selection so as to minimize the overall error in categorizing the pixels into “edge pixels” and “non-edge pixels.” Error occurs when an actual edge pixel is categorized as “non-edge pixel” (misdetection) or vice versa (false alarm).According to Bayes decision rule [52], a pixel at location (x,y) with edge-strength E is marked as an edge pixel if
(4)Pedge∣E>Pno_edge∣E,
where Pedge∣E and Pno_edge∣E denote the conditional probabilities that the pixel is an edge or not an edge, respectively. It follows that the decision boundary (threshold) between non-edge and edge pixels is given by the edge-strength value E for which
(5)Pedge∣E=Pno_edge∣E.
Therefore, the task now is to seek for suitable functions defining the conditional probabilities Pedge∣E and Pno_edge∣E such that the overall probability of classification error is minimized. Once these two probability functions are obtained, the required threshold is automatically established.In connection to the above stated task of finding suitable probability functions, we note the following.(i)
Since a pixel can only be either an edge pixel with some probability or not an edge pixel, these two events are mutually exclusive and form the total probability space. Therefore, we will have(6)Pedge∣E+Pno_edge∣E=1,orPedge∣E=1-Pno_edge∣E.(ii)
Since the edge-strength is the measure of the possibility of a pixel to be an edge pixel, it is intuitively desired that the probabilityPedge∣E be a monotonically non-decreasing function of the edge-strength measure E. It follows that Pno_edge∣E will be a monotonically non-increasing function of E.(iii)
The demarcation between “non-edge” and “edge” is generally fuzzy. This may be well characterized by defining a range of edge-strength valueE, say, E1,E2, corresponding to pixels of such ambiguous nature. In other words, pixels with edge-strength value in this range will have non-zero probability of being both an edge pixel and non-edge pixel; that is,
(7)0<Pno_edge∣E<1,0<Pedge∣E<1forE1<E<E2.(iv)
Based on the preceding observation, a pixel is definitely an edge pixel if its edge-strength exceedsE2. On the other hand, pixels with edge-strength less than E1 are definitely non-edge pixels. Accordingly, we will have
(8)Pno_edge∣E=1for0≤E≤E1,Pedge∣E=1forE2≤E≤1.


### 3.2.1. Fuzzy Two-Partition of Normalized Image Edge-Strength

Following the above discussion, we propose two trapezoidal functions definingPno_edge∣E and Pedge∣E, as depicted in Figure 3. The reason for this particular choice is its simplicity due to the linear nature of the functions in the intervals from E1 to E2. Nevertheless, some other complex functions represented by higher-order curves in the range E1,E2 may also be used, as per the will of the user.Figure 3
Trapezoidal functions representing the conditional probabilities for a pixel to be “edge” or “not edge,” given edge-strengthE of the pixel.The trapezoidal functions so chosen are completely defined when the values ofE1 and E2 are known. The required decision threshold is then obtained as
(9)Eth=12E1+E2.
Pixels with edge-strength value above Eth will be marked as edge pixels while those with edge-strength less than Eth will be classified as non-edges.Thus, the problem of optimal threshold selection now reduces to the problem of finding a pair of suitable values forE1 and E2 such that the overall error in identifying edge pixels is minimized. Error occurs when an actual edge pixel is not detected (misdetection) or when an actual non-edge pixel is marked as an edge pixel (false alarm). The probability of misdetection is given as
(10)PMD=∫0Eth‍Pedge∣EpEdE,PMD=∫0E1‍Pedge∣EpEdE+∫E1Eth‍Pedge∣EpEdE,PMD=∫E1Eth‍Pedge∣Ep(E)dE(∵Pedge∣E=0for0≤E≤E1)
and the probability of false alarm is calculated as
(11)PFA=∫Eth1Pno_edge∣Ep(E)dE,PFA=∫EthE2Pno_edge∣Ep(E)dE+∫E21Pno_edge∣Ep(E)dE,PFA=∫EthE2‍Pno_edge∣Ep(E)dE(∵Pno_edge∣E=0forE2≤E≤1),
where p(E) is the probability density function of the edge-strength E. The overall probability of error in detecting edge pixels in an image is the sum of the above two probabilities. That is,
(12)Perror=PMD+PFA.


### 3.2.2. Defining Objective Function

In our proposed work, the overall probability of error is used as the objective function, that is, to be minimized in determining the values ofE1 and E2. It is to be noted that although the edge-strength E is a continuous random variable in the range from 0 to 1, in practice we obtain only a finite number of discrete edge-strength values in this range from a finite-sized image having finite number of pixels. In view of this, the above objective function needs to be expressed in its discrete version, given as
(13)Perror=∑k=E1Eth‍(k-E1)(E2-E1)nkN+∑l=EthE2‍(E2-l)(E2-E1)nlN,
where nk denotes the number of pixels having edge-strength equal to k and N is the total number of pixels in the image. The summation in the first term is over all available discrete edge-strength values in the range of E1 to Eth. Similarly, the summation in the second term is over all discrete edge-strength values in the range of Eth to E2.As discussed above, the aim now is to search for the values ofE1 and E2 that minimize Perror; the search space for the same is illustrated in Figure 4. It may be noted that any point on the line E1=E2 yields Perror=0 and hence corresponds to a trivial solution. Therefore, in order to avoid this trivial solution, the line corresponding to E1=E2 is excluded from the search space.Figure 4
Search space for optimization to determine the values ofE1 and E2.The search space mentioned above consists of an infinite number of search points. Therefore, an exhaustive search is not feasible. In view of this, we propose using particle swarm optimization (PSO) [36]. It is a metaheuristic search procedure that has the capability of escaping from local minima and converging to the global minimum. PSO is simple, fast, and relatively stable from convergence point of view. This makes PSO a popular choice for carrying out the optimization operation in this particular situation.


### 3.2.3. Objective Function Optimization Using PSO

Now as expressed in (13), thresholding can be achieved by optimizing the given function and obtaining the values of E1 and E2. The steps of the algorithm for minimization of Perror using PSO are as follows.(1)
Set PSO parameters, namely, population size, maximum generation number, and inertia weight.(2)
Set a swarm within the search space. The position of every swarm particle in the search space is given by a pair ofE1 and E2 values.(3)
CalculatePerror for every swarm particle corresponding to its position.(4)
Assign initialpbest and gbest values for this swarm; pbest “personal best” refers to the best position of a swarm particle till now and gbest “global best” is the position of the particle having minimum Perror in the whole swarm.(5)
Run PSO to modify velocity and position of every particle in the swarm using the following equations:(14)vi(t+1)=ωvi(t)+c1r1[pbesti(t)-xi(t)]+c2r2gbestit-xit,xit+1=xit+vit+1,whereω is some predefined inertia weight, c1 and c2 are positive constants, r1 and r2 are random numbers between [0,1], xi(t) is the position of the ith particle at time t, and vi(t) is the velocity of the ith particle at time t. Generally, a large value of the inertia weight ω is desired for global convergence. Note that the location of a particle is restricted at the boundary of the search space if its new position is outside the search space.(6)
CalculatePerror for every swarm particle at its new position. The particle is retained at its new position if its recent Perror value is less than its previous value; else the particle is moved back to its earlier location.(7)
Updatepbest and gbest values in the swarm.(8)
Repeat for maximum number of PSO generations. The final solution is given by thegbest obtained in the final step of iteration.Thus, theE1 and E2 pair of values corresponding to the final solution in the search space is the desired result. The required optimal threshold is now calculated using (9) and then applied to obtain the final edge-map image.


## 3.2.1. Fuzzy Two-Partition of Normalized Image Edge-Strength

Following the above discussion, we propose two trapezoidal functions definingPno_edge∣E and Pedge∣E, as depicted in Figure 3. The reason for this particular choice is its simplicity due to the linear nature of the functions in the intervals from E1 to E2. Nevertheless, some other complex functions represented by higher-order curves in the range E1,E2 may also be used, as per the will of the user.Figure 3
Trapezoidal functions representing the conditional probabilities for a pixel to be “edge” or “not edge,” given edge-strengthE of the pixel.The trapezoidal functions so chosen are completely defined when the values ofE1 and E2 are known. The required decision threshold is then obtained as
(9)Eth=12E1+E2.
Pixels with edge-strength value above Eth will be marked as edge pixels while those with edge-strength less than Eth will be classified as non-edges.Thus, the problem of optimal threshold selection now reduces to the problem of finding a pair of suitable values forE1 and E2 such that the overall error in identifying edge pixels is minimized. Error occurs when an actual edge pixel is not detected (misdetection) or when an actual non-edge pixel is marked as an edge pixel (false alarm). The probability of misdetection is given as
(10)PMD=∫0Eth‍Pedge∣EpEdE,PMD=∫0E1‍Pedge∣EpEdE+∫E1Eth‍Pedge∣EpEdE,PMD=∫E1Eth‍Pedge∣Ep(E)dE(∵Pedge∣E=0for0≤E≤E1)
and the probability of false alarm is calculated as
(11)PFA=∫Eth1Pno_edge∣Ep(E)dE,PFA=∫EthE2Pno_edge∣Ep(E)dE+∫E21Pno_edge∣Ep(E)dE,PFA=∫EthE2‍Pno_edge∣Ep(E)dE(∵Pno_edge∣E=0forE2≤E≤1),
where p(E) is the probability density function of the edge-strength E. The overall probability of error in detecting edge pixels in an image is the sum of the above two probabilities. That is,
(12)Perror=PMD+PFA.


## 3.2.2. Defining Objective Function

In our proposed work, the overall probability of error is used as the objective function, that is, to be minimized in determining the values ofE1 and E2. It is to be noted that although the edge-strength E is a continuous random variable in the range from 0 to 1, in practice we obtain only a finite number of discrete edge-strength values in this range from a finite-sized image having finite number of pixels. In view of this, the above objective function needs to be expressed in its discrete version, given as
(13)Perror=∑k=E1Eth‍(k-E1)(E2-E1)nkN+∑l=EthE2‍(E2-l)(E2-E1)nlN,
where nk denotes the number of pixels having edge-strength equal to k and N is the total number of pixels in the image. The summation in the first term is over all available discrete edge-strength values in the range of E1 to Eth. Similarly, the summation in the second term is over all discrete edge-strength values in the range of Eth to E2.As discussed above, the aim now is to search for the values ofE1 and E2 that minimize Perror; the search space for the same is illustrated in Figure 4. It may be noted that any point on the line E1=E2 yields Perror=0 and hence corresponds to a trivial solution. Therefore, in order to avoid this trivial solution, the line corresponding to E1=E2 is excluded from the search space.Figure 4
Search space for optimization to determine the values ofE1 and E2.The search space mentioned above consists of an infinite number of search points. Therefore, an exhaustive search is not feasible. In view of this, we propose using particle swarm optimization (PSO) [36]. It is a metaheuristic search procedure that has the capability of escaping from local minima and converging to the global minimum. PSO is simple, fast, and relatively stable from convergence point of view. This makes PSO a popular choice for carrying out the optimization operation in this particular situation.


## 3.2.3. Objective Function Optimization Using PSO

Now as expressed in (13), thresholding can be achieved by optimizing the given function and obtaining the values of E1 and E2. The steps of the algorithm for minimization of Perror using PSO are as follows.(1)
Set PSO parameters, namely, population size, maximum generation number, and inertia weight.(2)
Set a swarm within the search space. The position of every swarm particle in the search space is given by a pair ofE1 and E2 values.(3)
CalculatePerror for every swarm particle corresponding to its position.(4)
Assign initialpbest and gbest values for this swarm; pbest “personal best” refers to the best position of a swarm particle till now and gbest “global best” is the position of the particle having minimum Perror in the whole swarm.(5)
Run PSO to modify velocity and position of every particle in the swarm using the following equations:(14)vi(t+1)=ωvi(t)+c1r1[pbesti(t)-xi(t)]+c2r2gbestit-xit,xit+1=xit+vit+1,whereω is some predefined inertia weight, c1 and c2 are positive constants, r1 and r2 are random numbers between [0,1], xi(t) is the position of the ith particle at time t, and vi(t) is the velocity of the ith particle at time t. Generally, a large value of the inertia weight ω is desired for global convergence. Note that the location of a particle is restricted at the boundary of the search space if its new position is outside the search space.(6)
CalculatePerror for every swarm particle at its new position. The particle is retained at its new position if its recent Perror value is less than its previous value; else the particle is moved back to its earlier location.(7)
Updatepbest and gbest values in the swarm.(8)
Repeat for maximum number of PSO generations. The final solution is given by thegbest obtained in the final step of iteration.Thus, theE1 and E2 pair of values corresponding to the final solution in the search space is the desired result. The required optimal threshold is now calculated using (9) and then applied to obtain the final edge-map image.


## 4. Experimental Results and Comparison

In our experiments, we applied our proposed method for edge detection on gray and color images and compared its performance with adaptive threshold to that with fixed threshold values. We also compared the performance of our proposed method with three classical edge detectors, namely, Canny, Roberts, and Sobel, and with one of the recently reported algorithms, namely, bacterial foraging edge detection method given in [33].In a first set of experiments, we used four gray-scale images, namely, “goat,” “hyena,” “elephant,” and “rhino,” available at [53]. For each of these images, the associated desired binary contour map, drawn manually by experts, was also available alongwith. The edge detection results obtained in all these cases, by applying the various edge detectors mentioned above, are shown in Figures 5, 6, 7, and 8. Using the performance measure introduced in [9], we evaluated the P values, as defined below, for all these cases and tabulated in Table 1. Consider
(15)P=card(E)card(E)+card(EFP)+card(EFN),
where E is the set of correctly detected contour pixels, EFP is the set of false positives, that is, non-edge pixels detected as edge pixels, EFN is the set of false negatives, that is, edge pixels not detected, and card(·) denotes the cardinality of a set. It may be noted that the manually drawn contour does not necessarily always exactly coincide with a local maximum of the gradient magnitude operator. Hence, a contour pixel is considered to be correctly detected if a desired contour pixel is present in a 5 × 5 neighbourhood around the concerned pixel, as suggested in [9].Table 1
P values obtained for different test images.
Methods
Test images
Goat
Hyena
Elephant
Rhino
Sobel (threshold = 0.05)
0.18
0.14
0.22
0.24
Sobel (threshold = 0.15)
0.21
0.29
0.12
0.10
Canny (threshold = 0.05)
0.08
0.10
0.13
0.09
Canny (threshold = 0.15)
0.11
0.13
0.20
0.16
Roberts (threshold = 0.05)
0.24
0.12
0.27
0.25
Roberts (threshold = 0.15)
0.23
0.30
0.09
0.12
Fuzzy-BFA
0.31
0.35
0.32
0.33
Proposed (threshold = 0.18)
0.13
0.07
0.17
0.09
Proposed (threshold = 0.35)
0.3
0.27
0.35
0.27
Proposed (optimal threshold)
0.23
0.37
0.34
0.29Figure 5
Edge detection results of “goat” image: desired edge output of “goat” image; Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 6
Edge detection results of “hyena” image: desired edge output of “hyena” image; Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 7
Edge detection results of “elephant” image: desired edge output of “elephant” image; Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 8
Edge detection results of “rhino” image: desired edge output of “rhino” image; Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.In a second set of experiments, we applied our proposed method for edge detection and the various other methods mentioned above on two gray and four color images as shown in Figures9, 10, 11, 12, 13, and 14. We observe that the performance of the Sobel and Roberts method is highly dependent on the choice of the threshold and shows high rate of misdetection even at lower threshold values. This problem is taken care of through additional processing such as edge-strength estimation and optimal thresholding in our method, as evident from the results shown. Canny’s classical edge detector is considered to be one of the best performing edge detection algorithms available in literature. We observe that while Canny’s method is highly dependent on the value of threshold selected, true edges are appropriately detected in our method by automatic thresholding. In case of BFA-based edge detection thick or double edges are obtained while better edge localization is achieved in our proposed method. We also observe that when fixed values of threshold are used in our method, there is more probability of misdetection (for high value of threshold) or more false alarm (for low value of threshold). On the other hand, selection of optimal threshold through optimization aids in better edge detection. Threshold values obtained in our experiments are tabulated in Table 2.Table 2
Threshold values obtained for different test images.
Test images
Different threshold values
E
1
E
2
Final threshold
(E1+E2)/2
Goat
0.1842
0.3078
0.2460
Hyena
0.1706
0.3020
0.2363
Elephant
0.1848
0.2552
0.2200
Rhino
0.1612
0.2888
0.2250
Lena
0.1989
0.2567
0.2278
Peppers
0.1969
0.2535
0.2252
House
0.1990
0.2654
0.2322
Cameraman
0.1978
0.2564
0.2271
Trees
0.1968
0.2564
0.2266
Coins
0.1979
0.2923
0.2451Figure 9
Edge detection results of “lena” image: Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 10
Edge detection results of “peppers” image: Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 11
Edge detection results of “house” image: Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 12
Edge detection results of “cameraman” image: Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 13
Edge detection results of “trees” image: Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.Figure 14
Edge detection results of “coins” image: Sobel, Canny’s, and Roberts methods using thresholds = 0.05 and 0.15; fuzzy-BFA method; proposed method with fixed thresholds (0.18 and 0.35) and optimal threshold.


## 5. Conclusion

This paper presents a fuzzy approach to edge detection via estimation of edge-strength at every pixel location in the input image. Following this, optimal thresholding is achieved by minimizing the probability of error in edge identification. The method is an extension of the gradient-based edge detectors. Here the horizontal and vertical gradients are combined using some fuzzy rules to give a measure of the edge-strength. Decision regarding pixel to be considered as an edge or non-edge is based on the threshold value selection by optimizing (minimization) the edge detection error. In order to fast search through the infinite number of search points, meta-heuristic optimization approach such as the PSO is employed. Thus, this method does away with manual selection of threshold and hence is free from any user intervention. However, as in case of most fuzzy systems, the performance of our proposed method obviously depends on the choice of the fuzzy sets and the fuzzy membership functions. Therefore, proper choice of the fuzzy functions is necessary to detect true edges in the input image. Experimental results show that the true edges are detected with high efficiency.



---

*Source: 365817-2014-12-14.xml*