matlab - segmentation of texture with k means -
i have texture pic , want segment using k-mean algorithm. wrote:
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)
but im not sure this,would please me? need have result like: http://upload7.ir/images/91105509914760477547.jpg
for input image:
http://upload7.ir/images/20702551133388585947.jpg
Comments
Post a Comment