Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

test image projection

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 ?

test image projectionFace Recognition steps: Project Test Image

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 ?