當我在Matlab 2012A執行以下命令圖像分割K均值
centroids=kmeans(imread('image.jpg'),4);
我得到以下錯誤:
Error using +
Integers can only be combined with integers of the same class, or scalar doubles.
Error in kmeans>distfun (line 659)
D(:,i) = D(:,i) + (X(:,j) - C(i,j)).^2;
Error in kmeans (line 273)
D = distfun(X, C, distance, 0, rep, reps);
我需要將圖像分割成4個簇。該圖像是JPEG
格式的CT腦腫瘤圖像。這個圖像的大小是233x216
。
請給我一個解決方案來聚集這個圖像文件。
這種情況下'X'和'C'是什麼? – Schorsch