Filter löschen
Filter löschen

Error { using * Inner matrix dimensions must agree.} in EigenfaceCore.m ==> Eigenfaces = A * (L_eig_vec); % A: centered image vectors in main.m ==> [m, A, Eigenfaces] = EigenfaceCore(T);

1 Ansicht (letzte 30 Tage)
This code was running well when the training image names were in sequential order, but i change their names into k132235_1.bmp , k132235_2.bmp etc
error occured !!!!
My code in EigenFaceCore.m
function [m, A, Eigenfaces] = EigenfaceCore(T)
m = mean(T,2);
Train_Number = size(T,2);
display(Train_Number);
A = [];
for i = 1 : Train_Number
temp = double(T(:,i)) - m; % Computing the difference image for each image in the training set Ai = Ti - m
A = [A temp]; % Merging all centered images
end
L = A'*A; % L is the surrogate of covariance matrix C=A*A'.
[V, D] = eig(L); % Diagonal elements of D are the eigenvalues for both L=A'*A and C=A*A'.
L_eig_vec = [];
for i = 1 : size(V,2)
if( D(i,i)>1 )
L_eig_vec = [L_eig_vec V(:,i)];
end
end
Eigenfaces = A * (L_eig_vec);

Antworten (1)

Walter Roberson
Walter Roberson am 22 Dez. 2016
Your L matrix might possibly be positive-definite so its eigenvalues might be non-negative, but they are not restricted to being greater than 1, so it is possible that none of your D elements are > 1, so you might not be putting anything into L before you do the multiplication.
  1 Kommentar
waqas siddiqui
waqas siddiqui am 23 Dez. 2016
Bearbeitet: waqas siddiqui am 23 Dez. 2016
when i am subtracting my T from m it results all 0's how this can be ?
m = mean(T,2); // mean has positve values
Train_Number = size(T,2); // positive
A = [];
for i = 1 : Train_Number
temp = double(T(:,i)) - m; // this returns 0 even though T is also positive
A = [A temp]; % Merging all centered images
end

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by