How to make output from FCM consistent (Fuzzy c-means clustering)?

3 Ansichten (letzte 30 Tage)
Ivan Shorokhov
Ivan Shorokhov am 8 Nov. 2015
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 Kommentare
Fadhil M
Fadhil M am 27 Jul. 2021
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
Diboun Mohsen Djawad am 8 Sep. 2021
use: rng('default');
like just before : rand ... or something
it will work just make sure your Matlab version is not too old:)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Dayangku Nur Faizah Pengiran Mohamad
How to find thresholding in FCM code?
[ctr,class]=fcm(data,2);
Do you how to find inner code for fcm from MATLAB?
  1 Kommentar
Pallavi Saha
Pallavi Saha am 14 Sep. 2017
The output of the fcm is constantly changing, any ideas in this regard will be helpful

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Clustering finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by