1

有一个灰度图像A,我想应用 kmeans 聚类K=2,MATLAB 给我以下代码的错误,如何解决?

[idx,ctrs] = kmeans(im2double(A),2);
??? Error using ==> minus
Number of array dimensions must match for binary array op.

Error in ==> kmeans>onlineUpdate at 576
        Del(:,i) = (m(i) ./ (m(i) + sgn)) .* sum((X - C(repmat(i,n,1),:)).^2, 2);

Error in ==> kmeans at 341
        converged = onlineUpdate(); 
4

1 回答 1

0

您需要将图像分解为“矢量”组件才能使用 Matlab kmeans。请参阅此处的示例:http: //imageprocessingblog.com/ ?p=178

于 2013-07-05T15:31:05.433 回答