Face recognition using eigenvalues code...PLEASE HELP!!

1 view (last 30 days)
I am creating a code that will implement face recognition using eigenvalues and eigenvectors. The code was copied from a textbook so I am not sure what I am doing wrong. This is the error that I get:
Error using * Inner matrix dimensions must agree.
Error in eigenfaces (line 43) proj_a=a*V

Answers (1)

Walter Roberson
Walter Roberson on 19 Nov 2015
The "*" operation is the linear algebra matrix multiplication operation, which requires that the two operands are two-dimensional matrices and that the size of the second dimension of the first operand (a here) is the same same as the size of the first dimension of the second operand (V here): an array that is (m x n) * an array that is (n x p) produces a result that is size m x p.
If size(a,2) ~= size(V,1) then you get the error shown.
At the MATLAB command line, give the command
dbstop if error
and run your code. When it stops because of the error, show
size(a), size(V)
and you will see that they do not match. We do not have your code or your input data so we do know why you are getting that error.
But if I were to guess, my guess would be that you have used a truecolor image with a routine that expects a grayscale image.

Community Treasure Hunt

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

Start Hunting!