% Please cite the paper "Tao Lei, Xiaohong Jia, Yanning Zhang, Shigang Liu, Hongying Meng and Asoke K. Nandi, 
%Superpixel-based Fast Fuzzy C-Means Clustering for Color Image
%Segmentation, IEEE Transactions on Fuzzy Systems,2019"

% The paper is OpenAccess and you can download freely from "http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8265186."
% The code was written by Tao Lei and Xiaohong Jia in 2018.
clc 
clear 
%% 
cluster=2;
f_ori=imread('100080.jpg'); 
% Note that you can repeat the program for several times to obtain the best
% segmentation result for image '12003.jpg'
%% generate superpixels
L1=w_MMGR_WT(f_ori,3);
L2=imdilate(L1,strel('square',2));
[~,~,Num,centerLab]=Label_image(f_ori,L2);
%% fast FCM
Label=w_super_fcm(L2,centerLab,Num,cluster);
Lseg=Label_image(f_ori,Label);
figure,imshow(Lseg);

