Face Recognition steps: Project Test Image

asked 2014-04-16 11:09:49 -0500

Ghilas BELHADJ gravatar image

updated 2014-04-16 11:35:14 -0500

I've some issue with the understanding of the eigenface recognition steps, I've read somewhere that we must project the test image into the eigenspace, and then calculate the distance between the projected image test and the stored projection vectors.

// READ THE STORED LEARN DATA
FileStorage fs("test.xml", FileStorage::READ);
Mat stored_mean, stored_eigenvalues, stored_vectors, stored_projections, stored_labels;
int stored_num_componants = fs["num_components"];
fs["mean"] >> stored_mean;
fs["eigenvalues"] >> stored_eigenvalues;
fs["eigenvectors"] >> stored_vectors;
fs["projections"] >> stored_projections;
fs["labels"] >> stored_labels;

// PROJECT THE TEST IMAGE
Mat result;
pca.project(testImageInGrayScale, result); // bugs here ...

// PRINT THE DISTANCES
for (int i = 0; stored_projections.rows; ++i){
    qDebug() << norm( stored_projections.row(i),weightVect );
}

the error code is:

OpenCV Error: Assertion failed (mean.data && eigenvectors.data && ((mean.rows == 1 && mean.cols == data.cols) || (mean.cols == 1 && mean.rows == data.rows))) in project, file c:/opencv/sources/modules/core/src/matmul.cpp, line 3042

am I totaly wrong ? or I've just used a wrong method and the wrong types ?

edit retag flag offensive close merge delete