Bonsoir tt le monde

Je suis en train de faire la classification d'une image avec FCM en matlab. Voila le code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
I1 = (imread('file90.png'));
s=0;
data = reshape(I1, [], 1);
 n=size(I1,1);
 m=size(I1,2);
 k=0;
 
for i=1:n+m
 
  options = [data NaN NaN 0];
    [centers,U] = fcm(data,2);
 
    maxU = max(U);
    index1 = find(U(1,:) == maxU);
    index2 = find(U(2,:) == maxU);
 
    index3 = find(maxU < 0.6);
 
    averageMax = mean(maxU);
 
    subplot(2,2,i)
    plot(data(index1,1),data(index1,2),'ob')
    hold on
    plot(data(index2,1),data(index2,2),'or')
    plot(data(index3,1),data(index3,2),'xk','LineWidth',2)
    plot(centers(1,1),centers(1,2),'xb','MarkerSize',15,'LineWidth',3)
    plot(centers(2,1),centers(2,2),'xr','MarkerSize',15,'LineWidth',3)
    hold off
    title(['M = ' num2str(M(i)) ', Ave. Max. = ' num2str(averageMax,3)])
end
L'erreur

Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Error in Untitled (line 27)
  options = [data NaN NaN 0];
aidez moi svp

Merci d'avance