有一个灰度图像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();