Applying k means to matrix
Show older comments
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
on 27 Nov 2012
Okay, go ahead. The function name is kmeans()
Pat
on 27 Nov 2012
Walter Roberson
on 27 Nov 2012
You are overwriting "f" on each iteration of the loop.
What do the arguments "2" and "z2(i)" represent to you?
Pat
on 27 Nov 2012
Edited: Walter Roberson
on 27 Nov 2012
Pat
on 27 Nov 2012
Walter Roberson
on 27 Nov 2012
I don't understand what that code is intended to do, and I do not understand how you ended up (in your file) with multiple entries with the same pixel value.
Anyhow, let us stick for the moment with the question of what kmeans(2,z2(i)) means to you. Why is the first argument always 2? Why is the second argument variable? Which argument represents the number of clusters? Which argument represents the data to be clustered?
Pat
on 27 Nov 2012
Walter Roberson
on 27 Nov 2012
Time for you to re-read the documentation for kmeans to see what arguments it expects to be passed in.
Pat
on 27 Nov 2012
Walter Roberson
on 27 Nov 2012
Okay, so what is your current version of the code (after taking the documentation into account) ?
Pat
on 27 Nov 2012
Answers (0)
Categories
Find more on Neighborhood and Block Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!