How to make output from FCM consistent (Fuzzy c-means clustering)?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello everybody,
[Problem]
I have 'brain' dicom image. I need to segment it into 3 clusters. I used the FCM method (code given bellow). It is a 3 level FCM thresholding. When I apply it to the images, I am getting 3 clusters, but all the time images appear in different figures. So I'm can't use fcmImage(index1{1,1}), for the next step as in the next time the fcmImage(index1{1,1}) can be replaced with some other index, for example with fcmImage(index1{1,2}).

[Code Used]
close all; clear all; clc;
I = im2double(imread('brain.jpg'));
I = imadjust(I);
data = [I(:)];
%Number of clusters
num_clust = 3;
% Fuzzy C-means classification with 3 classes
[center,U,obj_fcn] = fcm(data,num_clust);
% Finding the pixels for each class
maxU = max(U);
fcmImage(1:length(data))=0;
for n_c= 1:num_clust
index1{n_c} = find(U(n_c,:) == maxU);
end
% Assigning pixel to each class by giving them a specific value
fcmImage(index1{1,1})= 0.9;
fcmImage(index1{1,2})= 0.5;
fcmImage(index1{1,3})= 0.3;
[M,N] = size(I);
% Reshapeing the array to a image
imagNew = reshape(fcmImage,M,N);
figure;imshow(imagNew,[]);
%figure;imshow(I,[]);
So here is there randomized outputs images:



[Need] How to make output from FCM more consistent, is there any sort of labeling.
[Matlab version] R2015b
[Acknowledgement] Thanks in advance for any help. I will vote for all your answers.
@Image Analyst
@Walter Roberson
2 件のコメント
Fadhil M
2021 年 7 月 27 日
I have the same problem here, i've tried to constantly set the initial membership matrice by rng() function, and either using fixed initial centroid. both still returning inconsistent output (output centers seems to randomly assigned, not sorted). anyone knows why??
Diboun Mohsen Djawad
2021 年 9 月 8 日
use: rng('default');
like just before : rand ... or something
it will work just make sure your Matlab version is not too old:)
回答 (1 件)
Dayangku Nur Faizah Pengiran Mohamad
2017 年 2 月 8 日
How to find thresholding in FCM code?
[ctr,class]=fcm(data,2);
Do you how to find inner code for fcm from MATLAB?
1 件のコメント
Pallavi Saha
2017 年 9 月 14 日
The output of the fcm is constantly changing, any ideas in this regard will be helpful
参考
カテゴリ
Help Center および File Exchange で Data Clustering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!