[Main color extraction] Fuzzy C-means (FCM) clustering algorithm and color image fast fuzzy C-means (CIQFCM) clustering algorithm

Table of Contents of Series Articles


Chapter 1 Introduction to Main Color Extraction: FCM and CIQFCM


Table of contents

Table of Contents of Series Articles

Preface

1. FCM clustering algorithm

1 Basic idea

Edit

 2 Disadvantages of FCM

2. CIQFCM clustering algorithm

1 Cluster space mapping

1.1 Basic idea

 1.2 Compress clustering samples

2. Determining method of initial class center

3 Sampling CIQFCM clustering algorithm

Summarize



Preface

Main color extraction technology is widely used in camouflage design, camouflage evaluation, image segmentation, image mixing, image retrieval, remote sensing image analysis, medical image analysis and other fields. The FCM clustering algorithm proposed by Dunn in 1973 is due to its high clustering accuracy and relatively wide applicability, and CIQFCM is an improvement of the FCM algorithm.


1. FCM clustering algorithm

1 Basic idea

The basic idea of ​​the FCM clustering algorithm is to divide n samples xi (i=1, 2,, n) into c fuzzy clusters and find the cluster center of each cluster. The minimization objective function is:

Among them, m > 1 is a constant that can control the fuzzy degree of clustering results, and Jm is the objective function.

is the distance between sample xk and i-th cluster center vi, μik is the membership function of k samples to i-th category , which requires that the sum of the membership degrees of samples to each cluster is 1, as shown in Equation (2 ) shown.

 

In order to achieve the minimum Jm, the membership degree μik and the cluster center vi are updated according to the formula. (3) and (4). When updating μik, depending on whether dik is 0, there are two situations that need to be discussed:

 

 

Let b represent the number of iterations, and let the value of μibk be: 

The steps of the FCM clustering algorithm are as follows:

 2 Disadvantages of FCM

The FCM clustering algorithm is an iterative random hill-climbing algorithm, in which there are two problems that need to be solved. One is that if the initial cluster center is chosen incorrectly, the clustering effect will become worse or fail to converge to the optimal solution. Second, too many clustering samples will lead to a significant increase in the amount of clustering calculations .

Specifically, the FCM clustering algorithm believes that each sample belongs to a different category and has a certain degree of membership. This blurring method retains more information about the interconnection between samples, and is particularly suitable for main color extraction due to the overlapping nature of data sample distribution. However, in each iteration of the FCM clustering algorithm, it is necessary to calculate the membership degree U of all pixels to each cluster center and the new cluster center V. The number of operations for calculating U and V is n*c, so FCM The complexity of the algorithm is O(n* c* b). For large-sized images, the computational complexity will be high.

2. CIQFCM clustering algorithm

The CIQFCM clustering algorithm can quickly extract the dominant color of the background image. It is based on FCM and adds a thing called quantization interval. Its improvement is to make a small change when quantifying the color---compressing the sample size.

The whole process can be divided into three steps: first, map the clustering sample space from image pixels to the quantified color space, and use various methods to compress the clustering sample size. Then, an improved lineage clustering algorithm is used to obtain the initial class center. Finally, the CIQFCM clustering algorithm is used to quickly extract the dominant color of the background image.

1 Cluster space mapping

1.1 Basic idea

The purpose of clustering space mapping is to map clustered samples from image pixels to a quantized color space, thereby reducing the number of clustered samples while retaining the original information as much as possible. There are many methods for color quantification. CIELAB color space can use the equal-proportional quantization method to compress the three coordinates L, a, and b with a variable called the quantization interval with the goal of minimizing coordinate distortion. For example, assuming the quantization interval is 5, the three coordinates L, a, and b are divided into nL=100/5, na=240/5, and nb=240/5 levels respectively. At this time, there are Nc= nL *na* nb= 46080 quantized colors, which is 125 times less. For each level, the middle color value is used to represent the color of that level.

  Let P be the sample set of pixels in the image, let C be the quantized color matrix, and define the mapping relationship M from set P to set C as:

 

Among them, Np is the number of pixels in the image; the statistical NP of P on C represents the number of corresponding pixels after each quantization.

 Among them, Np is the number of elements in the set P, that is, the number of pixels in the image; Nc is the number of elements in the set C, that is, the number of quantized colors.

As shown below:

 1.2 Compress clustering samples

When the quantization interval is set to 5, the number of quantized colors is 46080, which is still a large number. As the quantization interval is further reduced, the number of samples becomes larger.

Therefore, to compress clustered samples, the colors appearing in the image usually do not cover the entire color space. Therefore, at each coordinate quantization, only the colors present in the image are considered.

The method is divided into two steps. The first step is to find the maximum and minimum values ​​of L, a, and b, and set the coordinate range of color quantification. The second step is to remove the statistics from the color space after completing the NP statistics. 0 elements to further reduce the amount of sample data.

2. Determining method of initial class center

In order to ensure the clustering effect and efficiency, the lineage clustering algorithm is used to initialize the cluster center. The idea of ​​performing lineage clustering on the mapped clustering space is basically the same as that of traditional lineage clustering. The difference between the two is that when calculating the new class center after merging the categories with the smallest distance, you need to use the statistic NP to perform color classification. Weighted, as shown in equation (11).

Among them, vk is the center of the k-th class after merging; Nk is the number of samples in the k-th class; Ci represents the color value of the i-th sample in the class; NPi represents the number of image pixels corresponding to the color of the i-th sample.

3 Sampling CIQFCM clustering algorithm

The CIQFCM clustering algorithm uses mapped color values ​​as cluster samples, which can greatly reduce the number of samples. The basic principle is to rewrite the calculation formula of the objective function Jm.

In the above three formulas, b is the number of iterations, m is the clustering control parameter, and c is the number of clustering categories. u ik (b) is the fuzzy membership degree of the k-th sample to the i-th category, dik is the distance from the k-th sample to the i-th cluster center, and is also the distance between ck and vi calculated by the CIE 94 color difference formula. Color difference.

The specific steps of the CIQFCM clustering algorithm are shown in the figure:


Summarize

(1) The method of compressing clustering samples after mapping is of great significance to improving the efficiency of the CIQFCM algorithm.

(2) The CIQFCM algorithm has good clustering effect compared with the PFCM clustering algorithm.

(3) The CIQFCM algorithm can improve clustering efficiency, and its advantages become more obvious as the image size increases.

For the CIQFCM algorithm, clustering space mapping needs to be performed before FCM clustering, so the advantages of the CIQFCM algorithm are not obvious when applied to small-size images.

The CIQFCM algorithm can quickly extract the main colors of large-size images and can be applied to camouflage coating design, image tone analysis, image segmentation and other fields.

Guess you like

Origin blog.csdn.net/m0_51816252/article/details/128240864