[FileName,PathName]=uigetfile('*.*');
Img=imread(strcat(PathName,FileName));
[row col dim]=size(Img);
imshow(Img);
Img=imread(strcat(PathName,FileName));
[row col dim]=size(Img);
imshow(Img);
RGB = reshape(Img, [row*col 3]);
RGB = double(RGB);
[FId FCClusters] = kmeans(RGB, 5, 'emptyaction','singleton');FId=reshape(FId,row,col);
figure;imagesc(FId)