我有纹理图片,想要使用K-mean算法对其进行分割。 我写道:
clc;clear;
I=imread('jyFMW.jpg');
[r c]=size(I)
%figure
%imshow(I)
%imhist(I)
R=double(I(:));
k=5;
[IDX,C]=kmeans(R,k);
B=zeros(size(C));
B(find( C == 1 )) = 0;
B(find( C == 2 )) = 50;
B(find( C == 3)) = 100;
B(find( C == 4 )) = 150;
B(find( C == 5 )) = 200;
S=reshape(B,r,c);
figure
imshow(S)
但我不确定这个,你能帮帮我吗?我需要一个像: http://upload7.ir/images/91105509914760477547.jpg