필터 지우기
필터 지우기

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 (최근 30일)
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개)

Walter Roberson
Walter Roberson 2016년 12월 22일
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
waqas siddiqui
waqas siddiqui 2016년 12월 23일
편집: waqas siddiqui 2016년 12월 23일
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

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by