error in kmeans

1 次查看(过去 30 天)
FIR
FIR 2012-2-25
I have 10 images i tried using
[IDX,C] = kmeans(I,10)
but i get error
Class of operand is not supported.
please help
for x = 1:length(dirlist)
I = (imread([pathname, dirlist(x).name]));
I=rgb2gray(I);
I =imresize(I ,[512 512]);
size(I);
[IDX,C] = kmeans(I,10)

回答(1 个)

Wayne King
Wayne King 2012-2-25
What version of MATLAB are you using? Are you sure you are using a MathWorks' version of kmeans.m? If you enter:
>>which kmeans
what do you get returned? Is it something like:
toolbox\stats\stats\kmeans.m
At any rate, try:
[IDX,C] = kmeans(double(I),10);

标签

Community Treasure Hunt

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

Start Hunting!

Translated by