Spatial \(\alpha \)-Trimmed Fuzzy C-Means Algorithm to Image Segmentation

  • Virna V. Vela-RincónEmail author
  • Dante Mújica-Vargas
  • Manuel Mejía Lavalle
  • Andrea Magadán Salazar
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12088)


An important aspect should be taken into account, when an image is segmented, the presence of atypical information. In this investigation an algorithm is proposed that is noise tolerant in the segmentation process. A method to image segmentation that combines Fuzzy C-Means (FCM) algorithm and Trimmed Means filter, called Spatial \(\alpha \) Trimmed Fuzzy C-means, using local information to achieve better segmentation. The FCM is very sensitive to noise, and the Trimmed Means filter is used to eliminate outliers with a lower computational cost. Compared to some state-of-the-art algorithms, the proposed is faster and noise tolerant, demonstrating better performance in the metrics considered.


Image segmentation Fuzzy C-Means \(\alpha \)-Trimmed means filter Spatial information 

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}$$
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}$$
$$\begin{aligned} c_{j}=\frac{\sum _{i=1}^{n}\mu _{ij}^{m}x_{i}}{\sum _{i=1}^{n}\mu _{ij}^{m}}\,, \end{aligned}$$

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}$$
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}$$
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}$$
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}$$
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}$$
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}$$
$$\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}$$
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}$$
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}$$
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}$$
  • Recall, measure the positive data that were clustered correctly.
    $$\begin{aligned} Recall = \frac{TP}{TP+FN} \end{aligned}$$
  • 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}$$
  • 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}$$

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.

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.

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.

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.

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.

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.



The authors of this work express their gratitude to CONACYT, as well as to the Tecnologico Nacional de Mexico/CENIDET for financing through the project "Diffuse Controller for adjusting stiffness coefficients of a deformable model for real-time simulation of the tissues of the human liver.


  1. 1.
    Alexandre, E.B.: IFT-SLIC: geração de superpixels com base em agrupamento iterativo linear simples e transformada imagem-floresta. Ph.D. thesis, Universidade de São Paulo (2017)Google Scholar
  2. 2.
    Bednar, J., Watt, T.: Alpha-trimmed means and their relationship to median filters. IEEE Trans. Acoustics, Speech, Signal Process. 32(1), 145–153 (1984)CrossRefGoogle Scholar
  3. 3.
    Bezdek, J.C., Ehrlich, R., Full, W.: FCM: the fuzzy c-means clustering algorithm. Comput. Geosci. 10(2–3), 191–203 (1984)CrossRefGoogle Scholar
  4. 4.
    Bezdek, J.C., Keller, J., Krisnapuram, R., Pal, N.: Fuzzy models and algorithms for pattern recognition and image processing, vol. 4. Springer, New York (1999). Scholar
  5. 5.
    Cai, W., Chen, S., Zhang, D.: Fast and robust fuzzy c-means clustering algorithms incorporating local information for image segmentation. Pattern Recogn. 40(3), 825–838 (2007)CrossRefGoogle Scholar
  6. 6.
    Chen, S., Zhang, D.: Robust image segmentation using FCM with spatial constraints based on new kernel-induced distance measure. IEEE Trans. Syst. Man Cybern. Part B (Cybernetics) 34(4), 1907–1916 (2004)CrossRefGoogle Scholar
  7. 7.
    Combalia, M., et al.: BCN20000: dermoscopic lesions in the wild. arXiv preprint arXiv:1908.02288 (2019)
  8. 8.
    Forsyth, D.A., Ponce, J.: Computer Vision: A Modern Approach. Prentice Hall Professional Technical Reference, New Jersey (2002)Google Scholar
  9. 9.
    Kohonen, T.: The self-organizing map. Proc. IEEE 78(9), 1464–1480 (1990). Scholar
  10. 10.
    Lei, T., Jia, X., Zhang, Y., He, L., Meng, H., Nandi, A.K.: Significantly fast and robust fuzzy c-means clustering algorithm based on morphological reconstruction and membership filtering. IEEE Trans. Fuzzy Syst. 26(5), 3027–3041 (2018)CrossRefGoogle Scholar
  11. 11.
    Li, M., Wang, L., Deng, S., Zhou, C.: Color image segmentation using adaptive hierarchical-histogram thresholding. PLoS ONE 15(1), e0226345 (2020)CrossRefGoogle Scholar
  12. 12.
    Mújica-Vargas, D., Gallegos-Funes, F.J., Rosales-Silva, A.J., de Jesús Rubio, J.: Robust c-prototypes algorithms for color image segmentation. EURASIP J. Image Video Process. 2013(1), 63 (2013)CrossRefGoogle Scholar
  13. 13.
    Pei, H.X., Zheng, Z.R., Wang, C., Li, C.N., Shao, Y.H.: D-FCM: density based fuzzy c-means clustering algorithm with application in medical image segmentation. Procedia Comput. Sci. 122, 407–414 (2017)CrossRefGoogle Scholar
  14. 14.
    Rockafellar, R.T.: Lagrange multipliers and optimality. SIAM Rev. 35(2), 183–238 (1993)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Sima, H., Guo, P., Zou, Y., Wang, Z., Xu, M.: Bottom-up merging segmentation for color images with complex areas. IEEE Trans. Syst. Man Cybern. Syst. 48(3), 354–365 (2017)CrossRefGoogle Scholar
  16. 16.
    Szeliski, R.: Computer Vision: Algorithms and Applications. Springer, London (2010). Scholar
  17. 17.
    Wang, M., Wan, Y., Gao, X., Ye, Z., Chen, M.: An image segmentation method based on fuzzy c-means clustering and cuckoo search algorithm. In: Ninth International Conference on Graphic and Image Processing (ICGIP 2017), vol. 10615, p. 1061525. International Society for Optics and Photonics (2018)Google Scholar
  18. 18.
    Winn, J., Criminisi, A., Minka, T.: Object categorization by learned universal visual dictionary. In: Tenth IEEE International Conference on Computer Vision (ICCV 2005) vol. 1. vol. 2, pp. 1800–1807. IEEE (2005)Google Scholar
  19. 19.
    Zhou, S., Lu, Y., Li, N., Wang, Y.: Extension of the virtual electric field model using bilateral-like filter for active contours. Signal Image Video Process. 13(6), 1131–1139 (2019)CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  • Virna V. Vela-Rincón
    • 1
    Email author
  • Dante Mújica-Vargas
    • 1
  • Manuel Mejía Lavalle
    • 1
  • Andrea Magadán Salazar
    • 1
  1. 1.Tecnlógico Nacional de México/CENIDETCuernavacaMexico

Personalised recommendations