Firstly, the local spatial information of the image is incorporated into THE FRFCM by introducing morphological reconstruction to ensure the anti-noise and image detail retention. Secondly, the modification of membership partitions based on the distance between local spatial neighbors and pixels within the cluster center is replaced by local membership filtering of spatial neighbors that only depend on membership partitions. Compared with the latest algorithms, the proposed FRFCM algorithm is simpler and significantly faster, because there is no need to calculate the distance between local space neighbors and pixels in the cluster center. In addition, membership filtering can effectively improve membership partition matrix, so it is effective for noise image segmentation. Experiments on synthetic and real-world images show that the proposed algorithm not only achieves better results, but also requires less time than the latest image segmentation algorithms.
clc
close all
clear all
%% parameters
cluster=3; % the number of clustering centers
se=3; % the parameter of structuing element used for morphological reconstruction
w_size=3; % the size of fitlering window
%% test a color image
f_ori=imread('3096.jpg');
figure(1)
subplot(121);imshow(f_ori);title('原图')
% GT=load('12003.mat'); % Ground Truth, download from 'https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/resources.html'
f_ori=double(f_ori);
%% implement the proposed algorithm
tic
[~,U1,~,~]=FRFCM_c(double(f_ori),cluster,se,w_size);
Time1=toc;
disp(strcat('running time is: ',num2str(Time1)))
f_ori;
f_seg=fcm_image_color(f_ori,U1);
subplot(122)
imshow(f_seg);title('分割后的图')
Copy the code
Complete code added QQ1575304183