Ask Your Question

Revision history [back]

FaceRecognizer interface - changes to 3.0.0

Downloaded the stable 3.0.0 release

// Get the eigen data that is available
Mat eigenvalues = face_model->getMat("eigenvalues");
Mat W = face_model->getMat("eigenvectors");
Mat mean = face_model->getMat("mean");

// Display the Eigenfaces:
for (int i = 0; i < min(10, W.cols); i++) {
    Mat ev = W.col(i).clone();
    Mat grayscale = norm_0_255(ev.reshape(1, test_faces[0].rows));
    Mat cgrayscale;
    applyColorMap(grayscale, cgrayscale, COLORMAP_JET);
    imshow(format("eigenface_%d", i), cgrayscale);

This code worked before, as stated in the tutorial :

But now it seems that the getMat function is gone and replaced getLabelInfoByString. However that one returns a vector of values instead of a Mat element. Anybody has gotten the visualisation to work again?