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);
Show older comments
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);
1 Comment
waqas siddiqui
on 22 Dec 2016
Answers (1)
Walter Roberson
on 22 Dec 2016
0 votes
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 Comment
waqas siddiqui
on 23 Dec 2016
Edited: waqas siddiqui
on 23 Dec 2016
Categories
Find more on Semantic Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!