テクスチャの写真があり、K 平均アルゴリズムを使用してセグメント化したいと考えています。私が書いた:
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
この入力画像の場合:
http://upload7.ir/images/20702551133388585947.jpg