Ask Your Question

FaceRecognizer interface - changes to 3.0.0

asked 2015-07-23 10:40:45 -0500

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?

edit retag flag offensive close merge delete


just saying, the (rst generated)docs page you refer to was generated in december 2014, the cv::Algorithm based getMat(string) interface was removed in the meantime

please try the more up-to-date example here

(sidenote:) if you've kept a Ptr<FaceRecognizer> fr = ... or such but your thing is actually a Fisher one, you'll have to use : Ptr<FisherFaceRecognizer> pf = pr.dynamicCast<FisherFaceRecognizer>() or similar

berak gravatar imageberak ( 2015-07-23 10:51:05 -0500 )edit

Well yes and I tracked it down to it being replaced by getLabelInfoByString, but the tutorial instructions are not updated yet. I am trying to find a way of generating the same pictures as in that guide.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-23 10:52:56 -0500 )edit

Since the latest one still got the errors -->

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-23 10:53:37 -0500 )edit

@berak Aha thank you! Someone should change the guidelines also :D

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-23 10:54:54 -0500 )edit

Oh damn, working on the 3.0.0 release and there those functions do not exist yet -_- I will dig in tomorrow to see what I can do.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-23 10:58:40 -0500 )edit

"Someone should change the guidelines also" - let's keep it in mind, and pester maxsim again, once he finishes transferring the whole wiki things to github ;)

berak gravatar imageberak ( 2015-07-23 11:01:18 -0500 )edit

well, about your link there - well, you know, what to do ..

berak gravatar imageberak ( 2015-07-23 11:03:35 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-23 11:04:56 -0500

I solved it, it seems that if you use Ptr<BasicFaceRecognizer> face_model = createEigenFaceRecognizer(); that it works, but if you use Ptr<FaceRecognizer> face_model = createEigenFaceRecognizer(); that it doesnt. You just have to get to find it :D

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-23 10:40:45 -0500

Seen: 138 times

Last updated: Jul 23 '15