2017-04-03 86 views

回答

2

只是做reshape

img = im2double(imread('cameraman.tif')); 
Nc = 2; %number of clusters is 2 

[centers,U] = fcm(img(:),Nc); 
subplot(121); 
imshow(reshape(U(1,:),size(img)),[]) 
title('fuzzy membership for class 1') 
colorbar() 
subplot(122); 
[~,I] = max(U,[],1); 
imshow(reshape(I,size(img)),[]) 
title('hard membership') 
colorbar() 

enter image description here