Fuzzy Index to Evaluate Edge Detection in Digital Images

In literature, we can find different metrics to evaluate the detected edges in digital images, like Pratt's figure of merit (FOM), Jaccard’s index (JI) and Dice’s coefficient (DC). These metrics compare two images, the first one is the reference edges image, and the second one is the detected edges image. It is important to mention that all existing metrics must binarize images before their evaluation. Binarization step causes information to be lost because an incomplete image is being evaluated. In this paper, we propose a fuzzy index (FI) for edge evaluation that does not use a binarization step. In order to process all detected edges, images are represented in their fuzzy form and all calculations are made with fuzzy sets operators and fuzzy Euclidean distance between both images. Our proposed index is compared to the most used metrics using synthetic images, with good results.


Introduction
In recent years, a wide variety of image taking devices has been developed. Thus, an advance in image processing techniques has become a major interest for many researchers. Although much has been accomplished, there is still a lot to do on this field. Image processing methods are complex, and widely used in a multitude of areas such as medicine, military, geographical, just to name a few [1], [2], [3].
Usually, images are processed for two reasons, first, for information extraction and second to improve their quality. To accomplish this, we need to pre-process these images; using techniques that help us obtain a more suitable image for the required application [4], [5], [6], [7].
There are several methods for noise elimination and edge detection [1], [2], [6], [8]. The processes mentioned above are considered to be opposite of each other because edge detection emphasizes the changes in the image tones while noise elimination minimizes these changes [7], [9].
Edges detection is one of the most widely used methods for image pre-processing since it is much faster than processing whole images from the start. In this way, total time execution is reduced dramatically.
There are different metrics for edges evaluation [17], [18], [19], [20], [21]; all of them are based on finding the similarity between two images. The first image corresponds to the detected edges, and the second image is the reference image or ground truth (GT), which is considered the image with the ideal edges.
All existing metrics include a previous step consisting on image binarization, but much information is lost and, as a result incomplete images will be evaluated. We show a color synthetic image in Fig 1(a), a wired synthetic image (GT) in Fig 1(b) and detected edges image in Fig 1(d). Images in Fig 1(b) and 1(d) are not binarized, while images in Fig 1(c) and 1(e) are binarized. The difference between images can be noticed easily, the loss of edges regions in binarized images is evident.
It has been shown that neural network systems for image processing get greater image recognition percentage when images used in training phase are processed with edges detection algorithms, specifically those improved using fuzzy inference systems [21] [22].
After visual inspection, images from fuzzy edges detectors show more details of original images and more homogeneous background. Better feature extraction allows train neural networks with more relevant attributes and less noise in data sets, improving their performance.
While visual analysis is very useful, it is also qualitative and subjective. For a more objective analysis, it is mandatory to quantify performance. Up to now, we have only found edges detector evaluation methods which need to binarize images before processing, with the disadvantage that the evaluated image will not be the same as the one actually used by the system.
The main contribution of this paper consists in a proposed method to calculate a fuzzy index for the evaluation of the detected edges of an image represented by its fuzzy form (without binarization) [4], [8], [9], [10], [16], [19].
The proposed fuzzy index FI integrates parameters that other metrics use separately. As shown in Table 1.
Since the proposed method was designed for fuzzy images, all the calculations were extended with fuzzy operators. Another significant contribution is the fuzzy extension of Euclidean distance [23] between two images; as part of the method for the calculation of an index to evaluate edge detection.
The paper is organized as follows: In a Section 2 we describe some metrics used to evaluate edge detection: The Euclidean distance [23], Pratt's Figure of Merit [20], Jaccard's index and Dice's coefficient [18]. In Section 3 the basic concepts of fuzzy sets operations, like intersection, bounded difference and magnitude of fuzzy set [5], [8] are described. In Section 4, we describe the proposed method, including fuzzy Euclidean distance and the algorithm to compute it.
Finally, we explain how parameters described in Section 3 are integrated, and an algorithm to compute fuzzy index (FI) is proposed. In Section 5, we show experiments and results made with different synthetic images and their comparison with traditional metrics. Section 6 is for our conclusions.

Metrics for Edges Detection Evaluation
In this section, we describe some existing metrics for edge detection evaluation. These methods are key for designing the proposed FI.

Euclidean distance between two images
The Euclidean distance between two points, as shown in Eq 1, is commonly used to find the similarity between two images. If one of the images is assigned as reference of correctly detected edges, the Euclidean distance can be a quality measure of the detected edges of another image.
Given two images A and B, the Euclidean distance between pixels can be calculated as follows: • • The image in Fig 2(c) shows the Euclidean distance from pixel a 1,1 to all other pixels on B.
• A value of 0 (zero) corresponds to the Euclidean distance from pixel a 1,1 to pixel b 1,1 and increases as pixels move farther.
• The image in Fig 2(d) shows Euclidean distances from a 3,3 to all other pixels on B.

Pratt's figure of merit (FOM)
One of the most used metrics is the Pratt's Figure of merit Eq 2 [20]. Abdou and Pratt proposed this metric in 1978 [17].
It uses Euclidean distance d 2 i [23] to compare two images, the first is the image of reference edges N i , which is also called Ground truth (GT) and the second is the detected edges image N d . It multiplies a scale factor / to the Euclidean distance calculated between the two images to penalize detected edges, this factor can vary or not even be used, and then it normalizes values and makes the sum of all calculations. Finally, it is multiplied by the inverse of the maximum amount of edge pixels between the two compared images. It is noteworthy that these metrics binarize data before evaluating images; this means that evaluation is made over images that have lost information. These metrics return values between 0 and 1, where 0 would mean that there were no similarities found between detected image and reference image, and 1 meaning that great similarity was found, in other words, all pixels found in one image edges are detected in the same position as the other.

Jaccard´s index (JI) and Dice´s coefficient (DC)
We also considered Jaccard´s index and Dice´s coefficient metrics [18], as shown below, which are based on rendering images with sets. Detected images are represented by set Results Set and reference images are represented by set Truth Set as is shown in Fig 3. In Results Set we have: False Positive (FP) or "false alarms" (these are pixels marked as edges when they are not), and True Positive (TP) (which are truly edges); in Truth Set we have True Positive (TP) and False Negative (FN) (these are pixels marked as not edges, but they really  are). These metrics are considered in the evaluation as false alarms (FP) and not detected edges (FN). The evaluation uses values between 0 and 1, where 0 means that there is no similarity between the images and 1 that the images are the same, but it also binarizes information before any evaluation is made.
Jaccard´s index (JI) and Dice´s coefficient (DC) use sets to represent images, as shown in Eqs 3 and 4 respectively. With the help of some set operations we are able to measure any detected edges, and these measures are some of the most applied.

Fuzzy sets
Today we can find a variety of areas where fuzzy logic is applied [24], [25], [26], [27], [28], [29], [30], [31]. For example, control is one of the areas where it is most used, simulation, prediction, optimization, information systems, such as databases, pattern recognition [32], [33], [34], [35], [36], [37] computer vision, etc. Fuzzy logic is an alternative to traditional logic, which assigns a degree of membership to evaluate things such as human reasoning. Fuzzy logic started in 1965 by Lotfi Zadeh, Professor at the University of Berkeley, mainly applied in control systems and complex industrial processes, working with information that is not accurate or with high inaccuracy [38].
There are concepts that do not have clear boundaries, this is why these fuzzy sets are associated to a linguistic value. Its membership function is defined in the range between 0 and 1, as shown in Eq 5.
A fuzzy set has been defined as shown in Eq 6, where μ A is the membership function of variable x in the universe of discourse U. The membership function is the essence of fuzzy sets and operations between fuzzy sets are based on it.

Fuzzy sets operators
There are different operations between fuzzy sets, such as union, intersection, complement, etc. In this paper we use intersection, bounded difference and fuzzy scalar cardinality, these are explained below.
Intersection of fuzzy sets. Given sets A and B, intersection C is defined as Eq 7. For fuzzy sets Zadeh introduced fuzzy intersection defined in Eq 8 as the search for minimum of two fuzzy sets [38]. Bounded difference of fuzzy sets. Given sets A and B, bounded difference C is defined as shown in Eq 9. Fuzzy bounded difference between A and B is defined in Eq 10 as the maximum of 0 and the difference between each membership values of A and B. This operator is not commutative, then the bounded difference between B and A is defined in Eq 11.
Magnitude of fuzzy sets. The magnitude of a fuzzy set can be calculated in different ways, one of which is the scalar cardinality defined as the sum of all the fuzzy values of each of the elements of the fuzzy set represented by Eq 12.
The Proposed Method

The fuzzy Euclidean distance
Given two images A and B, the fuzzy Euclidean distance between each pixel a i,j in A and all the pixels b i,j in B can be calculated with Eq 1 as described in section 2.1.
Once the Euclidean distance matrix D was calculated, the fuzzy Euclidean distance matrix FD can be obtained with some fuzzy membership function. In our method, we propose a triangular membership function as shown in Fig 5. Once the Euclidean distance matrix D was obtained, the fuzzy Euclidean distance matrix FD can be calculated with some fuzzy membership function. In our method we propose a triangular membership function.    In order to test that our proposed method finds the correct index for a given pair of images, synthetic images were generated as shown in the Figs 9,10 and 11 in order to control the amount of edges, and also to manipulate gray tones of pixels and to show their differences.

Fuzzy synthetic images
Each

Fuzzy sets operators for fuzzy images
Fuzzy sets operators between two fuzzy images can be defined according to the theory of fuzzy sets and the definitions in section 2.3.
Fuzzy true positive (FTP) between two fuzzy images. The set of true positive pixels between fuzzy images A and B is defined as the intersection of A and B. Then, FTP can be calculated using Eq 7.  Fuzzy false positive (FFP) between two fuzzy images. The set of false positive pixels between fuzzy images A and B is defined as the bounded difference between A and B. Then, FFP can be calculated using Eq 9.
Fuzzy false negative (FFN) between two fuzzy images. The set of false negative pixels between fuzzy images A and B is defined as the bounded difference between B and A. Then, FFN can be calculated using Eq 10.
Magnitude of a fuzzy image. The magnitude of a fuzzy image can be defined as the scalar cardinality |A| of a fuzzy image using Eq 11.

Calculation of the fuzzy index
Synthetic fuzzy images used in our proposal are matrices calculated by Eqs 14 and 15. The fuzzyfication of the images were made with triangular membership functions as described in Eq 13.
Where DI are the edges detected image, II are the reference image (ground truth), N d are the fuzzy detected image and N i are the fuzzy reference edge image (Ground Truth or GT).

Fuzzy Index to Evaluate Edge Detection in Digital Images
In our test, we used synthetic images stored in matrices N i and N d represented in their fuzzy form. Since images were already fuzzy, we started calculating fuzzy Euclidean distance. Then, we integrate FTP, FFP, FFN and Euclidean distance (FD) for the most similar pixels to obtain FI using Eq 16.

Experiments and Results
In this section we compare the results of the calculation of the fuzzy sets operators proposed in this paper, with non fuzzy sets operators. The calculations were made with all the images shown in Figs 9, 10 and 11, and all of them yield similar results. In Table 2, are shown the results of fuzzy and non fuzzy sets operators for some comparisons between images in Fig 10 (S1 Dataset).
The first observation was the value for all operators when two identical images were compared. For all operators, the similarity between the two images is 100% as expected. When we observe images in Fig 10(a) and 10(f), it is possible to note great differences. In this comparison  Once we observe the results of fuzzy operators above, we compute the FI using algorithms described in section 4.5, and results are shown in Table 3. The indices are in the interval [0,1], where 1 means that images compared are identical. Once again we can observe that the binarization of the images made before the calculation of FOM, JI and DC, forces the comparison results. For non fuzzy operators, we can observe 100% in similitude for images evidently different.
Synthetic images can be generated using some computer program, as the sphere shown in Fig 13. This image was generated using the function sphere of Matlab [39], this is an image of 200x200 (S2 Dataset).
The results on Table 4 shown that the non fuzzy indices FOM, JI and DC are identical, because the result is 1. But we can observe the images compared and found many differences. FI index calculates a very low similitude between the compared images, because of the few pixels correctly classified as edges, calculated as FTP. The non fuzzy operator TP instead, calculated a 100% of similitude between the images.
With the fuzzy index proposed, we can compare two fuzzy images with high precision. Then if one of the images is a ground truth of edges image, we can evaluate the correct edges detection in fuzzy images.

Conclusions
For a first conclusion of great importance, if the evaluation of an image without binarizing is carried out with more information about the image, you can have more pixels to work with.
The edge images without binarization used in classification systems allow us to achieve better recognition rates than the use of binarized images. Then the ability to evaluate the edges images in their fuzzy form can be used to preprocess data sets for optimal results.
Another important point is that we can use the simplest form of fuzzy logic to implement the evolution of images. We can notice in the results obtained that there is a great difference between the estimates obtained with traditional metrics because the FI we can give an index according to their gray tone and not simply dismiss it through a specified threshold.
These results show us that fuzzy logic is a good alternative in image processing and applied in many areas where it is extremely important edge detection.  The proposed fuzzy index is highly recommended, given the results. This fuzzy index includes parameters that other indices do not consider in their calculations, and allows us to compare two images represented as fuzzy sets.
Only synthetic images were used to calibrate proposed index FI, with very good results. Next step is to use it on real images. We are currently optimizing a fuzzy border detector to generate reference images that will help us evaluate border images given by our proposed index.
Supporting Information S1 Dataset. Matrices used for the tests that show Tables 2 and 3.
(ZIP) S2 Dataset. Images used for the tests that show Table 4. (ZIP)