how do i use kmeans clustering??

im loading a pic onion.png and using function kmeans(x,k) i assigned k=5. now problem is that i cant find what 'x' is and how to use it? never used matlab so dont know how to use the functions

8 Comments

Please show your code and describe more specifically "still having problem"
im loading a pic onion.png and using function kmeans(x,k) i assigned k=5. now problem is that i cant find what 'x' is and how to use it? never used matlab so dont know how to use the function
What aspect of the picture do you wish to cluster on ?
1. You need to load the image ‘onion.png’ 2. Select K=5 and use Matalb function kmeans to find 5 clusters in the given image (on the basis of color). 3. Assign the colors Red, Green, Blue, Yellow and Black to each of the 5 generated classes. 4. Your result may not necessarily correspond to the actual desirable segmentation of the given image. above is the task that i have to perform
onion.png is a coloured image
Please show your work so far.
a=imread('onion.png'); imshow(a); ab=double(a); cluster=kmeans(ab, 5); finalImage=reshape(cluster ,5); figure, imagesc(finalImage)
code i wrote till now

Answers (0)

This question is closed.

Tags

Asked:

on 21 Nov 2012

Community Treasure Hunt

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

Start Hunting!