当我在 Matlab 2012a 中执行以下命令时
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
.
请给我一个解决方案来集群这个图像文件。