Keywords

1 Introduction

Image segmentation is defined as a process by which an image is divided into homogeneous areas, each belonging to different objects with similar features (i.e. color, contrast, brightness, texture and so on) [16]. Segmentation has a many applications medical image analysis, autonomous vehicles, video surveillance, and augmented reality to count a few [8]. Generally, the image segmentation method are divided into histogram-based approaches [11], edge detection approaches [19], region-based approaches [15], clustering approaches [12].

One of the most popular image segmentation algorithms is Fuzzy C-means (FCM), which gives each data a degree of membership through a distance measure to assign to the nearest group [6, 17]. FCM is a noise sensitive algorithm, some investigations try to improve this algorithm, some guarantee noise immunity and preserve image details by incorporating local spatial and gray information together to enhances the clustering performance [5]; other try to reduce the high computational complexity that surge an iterative calculation of the distance between pixels within local spatial neighbors and clustering centers, based on morphological reconstruction and membership filtering [10]. There algorithms used to determinate the parameters by introducing density for each sample, where the density peaks are use to determinate the number of clusters and the initial membership matrix [13].

In this context, this paper considers the use of \(\alpha \)-Trimmed Means filter to add robustness to FCM and to ensure better performance spatial relationship is added using a median and a mean filter. An important contribution is that \(\alpha \) is not a simple parameter, it depends on the standard deviation of the data to be processed. Another important feature is the use of spatial information, since nearby pixels are more likely to belong to the same group. So, the objective of this paper is to segmented images that was corrupted with atypical information, specifically additive, multiplicative and fixed impulsive noise. The experimental results in different databases demonstrate that the proposed algorithm have a better performance compared to some algorithms of the state of the art being more tolerant to noise.

2 Background

2.1 Fuzzy C-Means

The Fuzzy C-means algorithm assigns each pixel to the nearest cluster, it allows a gradual membership in a closed interval of data \(\mu \in [0,1]\), with respect to the groups or regions of interest. This flexibility allows to express the membership of a data to all the groups or regions simultaneously. The problem of dividing a set of data into different groups is a the task of minimizing the square distances between the data and the centers of the groups. The objective function \(J_f\) is based on the sum of minimum square distances. Formally, a fuzzy clustering model of a given data set X in c groups is defined to be optimal when it minimizes the following objective function [4]:

$$\begin{aligned} J_{f}\left( X;U_{f},C\right) =\sum _{i=1}^{n}\sum _{j=1}^{c}\mu _{ij}^{m}d_{ij}^{2}\,, \end{aligned}$$
(1)

where \(U_{f}\) represents the membership matrix and C a vector with the centers of the cluster, \(\mu _{ij}\) is the membership of pixel \(x_i \) in the jth cluster, \(d^2_{ij}\) is a norm metric, and the parameter m controls the fuzziness of the resulting partition, and \(m=2\) is regularly used. The objective function \( J_ {f} \) is minimized by two steps. First the degrees of membership are optimized by setting the parameters of the groups, then the prototypes of the groups are optimized by setting the degrees of membership. The equations resulting from the two iterative steps form the Fuzzy C-Means clustering algorithm [4].

$$\begin{aligned} u_{ij}=\frac{1}{\sum _{k=1}^{c}\left( \frac{d_{ij}^{2}}{d_{ik}^{2}}\right) ^{\frac{2}{m-1}}}=\frac{d_{ij}^{-\frac{2}{m-1}}}{\sum _{k=1}^{c}d_{ik}^{-\frac{2}{m-1}}}\,, \end{aligned}$$
(2)
$$\begin{aligned} c_{j}=\frac{\sum _{i=1}^{n}\mu _{ij}^{m}x_{i}}{\sum _{i=1}^{n}\mu _{ij}^{m}}\,, \end{aligned}$$
(3)

2.2 \(\alpha \)-Trimmed Means Filter

It has been observed that the mean filter is more efficient in deleting Gaussian noise than the median filter, but it is less efficient in eliminating impulsive noise; while the median filter completely eliminates impulse noise. However, when there is Gaussian and impulsive noise, the trimmed means filter becomes an alternative between the mean and median filters.

The proposed algorithm is based on \(\alpha \)-Trimmed Means filter [2], which does an ascending sorting of data, removing (trimming) a fixed fraction \(\alpha \) (\(0 \le \alpha \le 0.5\)), called trimmed number, from high and low ends of sorted set, and calculate the average of the remaining values. This filter is given by:

$$\begin{aligned} \alpha \text {-trimmed mean filter} \{x_{(1)},\dots ,x_{(N)};\alpha \} = \sum _{i=\alpha N+1}^{N - \alpha N} x_{(i)}\frac{1}{N-2\alpha N} \end{aligned}$$
(4)

where N are the total number of samples and \(\alpha \)N the number of samples trimmed at each side. The subscript with parentheses \(x_{(i)}, i =1,...,N\) indicates the order statistics for example, \( x_{(1)} \le x_{(2)}\le ,\dots , \le x_{(N)} \).

3 Method

In this section, we present the proposed method to segment images with atypical information, this method combines the theory of the Fuzzy C-means algorithm and the \(\alpha \)-Trimmed Means filter, It also incorporates the spatial relationship of the pixels.

3.1 Mathematical Formulation of \(\alpha \)-Trimmed Fuzzy C-Means Algorithm with Spatial Information

To detect outliers grouped in a small group, we define the Spatial \(\alpha \)-Trimmed Fuzzy C-means (STrFCM) algorithm, which trim a fraction of the data, reducing processing time. In addition, the spatial relationship between the pixels and their neighbors was used through filtered images using the mean and the median. A clustering algorithm is defined as optimal when it minimizes its objective function, in this case can be formulated as follows:

$$\begin{aligned} J_{Tr}(X,\bar{ X},\tilde{X};U,C) = \sum _{i=1}^{H(\alpha )} \sum _{c=1}^{C} u_{ic}^m \Vert x_i - h_c \Vert ^2 + \alpha _1\sum _{i=1}^{H(\alpha )} \sum _{c=1}^{C} u_{ic}^m \Vert \bar{x_i} - h_c \Vert ^2 \nonumber \\ + \alpha _2\sum _{i=1}^{H(\alpha )} \sum _{c=1}^{C} u_{ic}^m \Vert \tilde{x_i} - h_c \Vert ^2, \quad \quad \sum _{c=1}^{C}u_{ic}=1, \quad u_{ic} \ge 0 \end{aligned}$$
(5)

where \(u_{ic}\) is the membership degree of element \(x_i\) to each of the groups, \( m>1\) is the fuzziness parameter. I ranges on all the subsets of the objects, containing \(H(\alpha ) = \lfloor I \cdot (1-\alpha )\rfloor \) objects (\( \lfloor \cdot \rfloor \) is the integer part of a given value). In order to enhance robustness of clustering, it is considered to take a window of 3x3 around the pixel as vectors with the mean and median \(\bar{ X},\tilde{X}\), respectively. \(\alpha _1\) and \(\alpha _2\) controls the compensation between the original image and the corresponding mean or median filtered image. To find the equations to update the membership matrix and the centers of the clusters, an optimization process must be carried out using Lagrange multipliers [14]. So, a new function \(\mathcal {L}\) is defined:

$$\begin{aligned} \mathcal {L}= \sum _{i=1}^{H(\alpha )}\sum _{c=1}^{C} u_{ic}^m \Vert x_i - h_c \Vert ^2 + \alpha _1\sum _{i=1}^{H(\alpha )} \sum _{c=1}^{C} u_{ic}^m \Vert \bar{x_i} - h_c \Vert ^2 \qquad \qquad \qquad \qquad \nonumber \\ + \alpha _2\sum _{i=1}^{H(\alpha )} \sum _{c=1}^{C} u_{ic}^m \Vert \tilde{x_i} - h_c \Vert ^2- \sum _{i=1}^{H(\alpha )} \lambda \Big (\sum _{c=1}^{C} u_{ij}-1\Big ) \end{aligned}$$
(6)

The necessary condition to minimize is that the partial derivatives of the Lagrange function become zero, that is

$$\begin{aligned} \Bigg \{ \begin{array}{l} \frac{\partial L}{\partial u_{ij}} = 0, \quad \Leftrightarrow \quad mu_{ij}^{m-1}\Vert x_i - h_j \Vert ^2 + \alpha _1 mu_{ij}^{m-1}\Vert \bar{x_i} - h_j \Vert ^2\\ \qquad \qquad \qquad \quad + \alpha _2mu_{ij}^{m-1}\Vert \tilde{x_i} - h_j \Vert ^2 = \lambda \quad \qquad \text { (a)}\\ \frac{\partial L}{\partial \lambda } = 0, \quad \Leftrightarrow \quad \sum _{c=1}^{C} u_{ic} = 1 \qquad \qquad \qquad \qquad \quad \text { (b)} \end{array} \end{aligned}$$
(7)

Solve for \(u_{ij} \) from Eq. 7.a, and get:

$$\begin{aligned} u_{ij}= \Bigg [ \frac{\lambda }{m({\, \Vert x_i - h_j \Vert ^2+\alpha _1\, \Vert \bar{x_i} - h_j \Vert ^2+\alpha _2\, \Vert \tilde{x_i} - h_j \Vert ^2})}\Bigg ]^{\frac{1}{m-1}} \end{aligned}$$
(8)

Summing these equations over clusters,

$$\begin{aligned} \begin{aligned} \sum _{c=1}^{C} u_{ic}&= \sum _{c=1}^{C}\Bigg [ \frac{\lambda }{m({\, \Vert x_i - h_c \Vert ^2+\alpha _1\, \Vert \bar{x_i} - h_c \Vert ^2+\alpha _2\, \Vert \tilde{x_i} - h_c \Vert ^2})}\Bigg ]^{\frac{1}{m-1}}\\ \\&= \Bigg (\frac{\lambda }{m}\Bigg )^{\frac{1}{(m-1)}}\Biggl \{ \sum _{c=1}^{C} \Bigg [\frac{1}{{\, \Vert x_i - h_c \Vert ^2+\alpha _1\, \Vert \bar{x_i} - h_c \Vert ^2+\alpha _2\, \Vert \tilde{x_i} - h_c \Vert ^2}}\Bigg ]^{\frac{1}{(m-1)}} \Biggr \} = 1 \end{aligned} \end{aligned}$$
(9)

So,

$$\begin{aligned} \Bigg (\frac{\lambda }{m}\Bigg )^{\frac{1}{(m-1)}} = \frac{1}{\sum _{c=1}^{C}\Bigg (\frac{1}{{\, \Vert x_i - h_c \Vert ^2+\alpha _1\, \Vert \bar{x_i} - h_c \Vert ^2+\alpha _2\, \Vert \tilde{x_i} - h_c \Vert ^2}}\Bigg )}^\frac{1}{m-1} \end{aligned}$$
(10)

Replace in the Eq. 8 to get the update equation for membership degrees,

$$\begin{aligned} \begin{aligned}\ u_{ij}&= \frac{{\,\big ( \Vert x_i - h_j \Vert ^2+\alpha _1\, \Vert \bar{x_i} - h_j \Vert ^2+\alpha _2\, \Vert \tilde{x_i} - h_j \Vert ^2\big )}^{-\frac{1}{m-1}}}{\sum _{c=1}^{C} \big ( \Vert x_i - h_c \Vert ^2+\alpha _1\, \Vert \bar{x_i} - h_c \Vert ^2+\alpha _2\, \Vert \tilde{x_i} - h_c \Vert ^2\big )^{-\frac{1}{m-1}}} \end{aligned} \end{aligned}$$
(11)

In a process similar to the previous one, the update equations for cluster centers can be obtained:

$$\begin{aligned} h_c = \frac{\sum _{i=1}^{I}u_{ic}^m [x_i + \alpha _1\bar{x_i} + \alpha _2\tilde{x_i}]}{(1+\alpha _1+\alpha _2)\sum _{i=1}^{I}u_{ic}^m } \end{aligned}$$
(12)

It is important to mention that the trimmed data only applies to the adjustment of the centers of the clusters, where i extends only in the subset of the non-trimmed objects I. To avoid defining different parameters in the proposed method, it was decided to use the standard deviation, as a way to establish a reference value based on the dispersion that exists in the data. This mainly applies to the \(\alpha \) parameter, and then extends over \(\alpha _1\) and \(\alpha _2\). \(\alpha \) and \(\alpha _2\) in most experiments remain at 0.2, while \(\alpha _1\) ranges from 0.5 to 0.6.

4 Experimental Results

In this section, we first describe the considered metrics to measure the quality of Image Segmentation, second, the databases where the algorithm proposed was tested, and finally the comparatives results with others algorithms.

4.1 Metrics

The metrics used were:

  • Accuracy, to measure the quality of the clustering.

    $$\begin{aligned} Accuracy = \frac{TP + TN}{TP + TN + FP + FN} \end{aligned}$$
    (13)
  • Recall, measure the positive data that were clustered correctly.

    $$\begin{aligned} Recall = \frac{TP}{TP+FN} \end{aligned}$$
    (14)
  • DICE similarity coefficient (DSC), quantify the overlap between segmentation results with the ground truth.

    $$\begin{aligned} DSC = 2 \bullet \frac{\text {Area}(X \cap Y)}{\text {Area}(X) + \text {Area}(Y)} \end{aligned}$$
    (15)
  • Jaccard similarity coefficient (JSC), was used to measure the quality of segmentation.

    $$\begin{aligned} JSC = \frac{\text {Area}(X \cap Y)}{\text {Area}(X) + \text {Area}(Y) -\text {Area}(X \bigcap Y)} \end{aligned}$$
    (16)

Where TP are the true positives, TN the true negatives, FP the false positives and FN the false negatives. X and Y represent the ground truth and segmented images, respectively.

4.2 Databases

This algorithm was tested in the following databases: ISIC 2019 database, contains over 13,000 dermoscopic images, for this paper only tested on 50 images since the images are very similar [7], Sky database, a collection of 60 images with ground truth for sky segmentation [1], Weizmann Segmentation Evaluation Database with 200 gray level images along with ground truth segmentations [18], in Fig. 1 only three images are depicted (one for each database).

Fig. 1.
figure 1

Sample image of each database.

4.3 Experimental Results

The algorithm was tested with Fuzzy C-means [3]; with a version FCM that incorporate spacial information (FCM_S2), the comparison is only against FCM_S2 and not against FCM_S1, because the first one has a better performance, the parameter \(\alpha \) from this algorithm was 3.8 [6]; with the SOM artificial neural network [9]; and with an improved FCM algorithm based on morphological reconstruction and membership filtering (FRFCM). All of them were implemented in the MATLAB R2018b environment. The parameters used in each execution are \(c=2\), \(m=2\) and \(\varepsilon =0.00001\). To evaluate the segmentation performance two experiments were implemented, one for medical image (ISIC 2019 Database) and other to real images (Sky and Weizmann databases).

Fig. 2.
figure 2

Quantitative result of the experiments with four metrics considered in medical image with the proposed algorithm and image corrupted by the noises considered.

Fig. 3.
figure 3

Qualitative result of the experiments in medical image with the proposed algorithm and image corrupted by the noises considered.

Medical Image Database. In Fig. 2 we can observe the quantitative results of the experiments with the three types of noise considered (Gaussian, Salt and Pepper and Speckle noise) on ISIC 2019 Database, the means value is zero to Gaussian and Speckle noise and the variance is defining by densities between 0.03 to 0.40 and 0.10 to 0.40, respectively; Salt and pepper noise images with densities between \( 3\% \) to \(40\%\). We can observe that the higher the density of the noise that corrupts the images, the algorithm of the proposal in most of the metrics considered shows a higher performance compared to the other algorithms, with an accuracy of approximately 95%. The qualitative results of the experiment are presented in Fig. 3, just to depict the results of the proposal algorithm, the segmentation result is shown by selecting the highest noise density with which the experiments were performed. Each row shows a result of the segmentation of each algorithm corrupted with the three types of noise considered. In all the type noises, the proposal algorithm shows a segmentation superior to the other methods, reinforcing the quantitative results.

Real Image Database. The second experiment performed on real image databases, Weizmann and Sky database, on Fig. 4 summarizes the quantitative results of the experiments performed in these databases, these demonstrate that the proposed method has an advantage over the other techniques with which it was compared, showing that the higher the noise the performance is better.

Fig. 4.
figure 4

Quantitative result of the experiments with four metrics considered in real images with the proposed algorithm and image corrupted by the noises considered.

Fig. 5.
figure 5

Qualitative result of the experiments in real images with the proposed algorithm and image corrupted by the noises considered.

The result of the previous segmentation shows that the algorithm of the proposal is tolerant to different types of noise. So, the qualitative result are presented on Fig. 5, just to depict the experiments, an image is shown, where each row is the result of segmentation with the three different types of noise, and the columns are the algorithms with which the comparison was made, here it is shown that the proposed algorithm has a higher performance than the other techniques.

The execution time, as shown in Table 1 in which the proposed algorithm exceeds others, except the FCM. Despite the fact that FCM is faster than the proposed method, it has lower performance and this research seeks to achieve better segmentation precision. The proposed algorithm is faster because when trim is applied to the data it removes approximately 40% when \( \alpha = 0.2 \) or 60% when \( \alpha = 0.3 \), therefore the execution time is reduced.

Table 1. Execution time (seconds) of tested algorithms

5 Conclusions and Future Work

This article focuses on the segmentation of images with atypical information, mainly adding to the images tested additive, multiplicative and impulsive fixed noise, with different densities. A technique was proposed that combines the Fuzzy C-Means algorithm and Trimmed Means filter, improving the segmentation performance since it also considers the spatial relationship between the pixels. We try to demonstrate that if spatial information is added to an algorithm, this will have a better performance. In the experiments we were able to verify this hypothesis, since our proposal algorithm had a better result than the rest of the selected algorithms. In addition it was experimented in different types of databases, medical and real images, obtaining high performance and demonstrating an average accuracy of 92%. Furthermore to the precision obtained, the algorithm proved to be faster than the other techniques. In many cases, our algorithm shows inferior performance in noise-free images, this happens because it was designed to be tolerant to image noise, which means that the algorithm result when there is no noise will not always be better than the methods for comparison. As future work, we plan to add texture or other characteristics to the images.