Error: no member named 'getMat' in 'cv :: face :: FaceRecognizer'

I am using the front face recognition demo from the opencv docs opencv-3.0

to implement this opencv .

I believe this demo was written with opencv-2.4

. However, I added contrib

src to my assembly as recommended in this SO answer .

However, I am now getting the following error:

error: no member named 'getMat' in 'cv::face::FaceRecognizer'


Violation code

Mat eigenvalues = model->FaceRecognizer::getMat("eigenvalues");


I am compiling my code like this

g++ -o facerec_demo facerec_demo.cpp `pkg-config --cflags --libs opencv`


Is there a way to fix this, or is this demo completely incompatible with opencv-3.0



source to share

1 answer

According to this example , model

the next line is a pointer to an instance of the class FaceRecognizer

instead of the object itself.

129:    Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
143:    Mat eigenvalues = model->getMat("eigenvalues");


So it makes sense that the function is getMat

not defined in the class FaceRecognizer

, but it must be defined for Ptr<FaceRecognizer>




All Articles