Applying k means to matrix

1 view (last 30 days)
Pat
Pat on 27 Nov 2012
I have the result after dividing same pixels into blocks,
result is in variable out in workspace
27 [1,9]
30 [1,12]
31 [1,13]
32 [1,14]
33 [1,15]
34 [1,16]
35 [1,17]
36 [1,18]
37 [1,19]
38 [1,20]
39 [1,21]
now i have to apply k means for the above result ,i.e for each block i have to apply k means
please help
  11 Comments
Walter Roberson
Walter Roberson on 27 Nov 2012
Okay, so what is your current version of the code (after taking the documentation into account) ?
Pat
Pat on 27 Nov 2012
Walter i tried
assuminug my values are
S=27 [1,9]
30 [1,12]
31 [1,13]
32 [1,14]
33 [1,15]
34 [1,16]
35 [1,17]
36 [1,18]
37 [1,19]
38 [1,20]
39 [1,21]
S=S(:,2);
S=cell2mat(S);
for i=1:length(S)
D=kmeans(S(i(:)),2);
r=reshape(D,1,[]);
end
dont know whether it is correct or not ,and i saw a reference code in
http://www.mathworks.in/matlabcentral/answers/46705-how-images-are-divided-into-sub-images
here the peppers image is divided into many parts,like that i want ti divide image ,such the each subimage has same pixel value,and then apply k means for each block

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!