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

조회 수: 3 (최근 30일)
Ivan Shorokhov
Ivan Shorokhov 2015년 11월 8일
댓글: Diboun Mohsen Djawad 2021년 9월 8일
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
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
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
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
Pallavi Saha 2017년 9월 14일
The output of the fcm is constantly changing, any ideas in this regard will be helpful

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Clustering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by