This article was written by the landlord by doing his homework long ago , If there is any problem, Mina sang is suggested to solve it by herself ~
The basic idea of the algorithm is given below :
1. You can initialize a membership matrix first U( The sum of membership degree of each sample to each class is 1).
2. according to U Start with the class center matrix C Calculate .
3. According to C Calculation U.
4. loop 2,3 Step until the cycle conditions are met , end .
Next I use np Of random Generate some data to FCM To display
Example 1:
Example 2:
Example 3:
The results of image segmentation are shown below ~
grayscale :( The cluster center shown below is 2 and 15 Two kinds of )
Ps: Do not set the cluster center too large , Don't make the picture too big !!!
Color picture :
You can see , After segmentation, the image can still have a clear outline , Only the number of types of grayscale or color is reduced .
Click here to , Mixed food is the best