Problems with FaceRecognition
Hello everyone,
I'm try to follow the tutorial from docs (here) , but when I try to compile, doesn't work.
Ptr<EigenFaceRecognizer> model = EigenFaceRecognizer::create();
model->train(images, labels);
The error:
error: ‘EigenFaceRecognizer’ was not declared in this scope
Ptr<EigenFaceRecognizer> model = EigenFaceRecognizer::create();
reconhecimento.cpp:72:25: error: template argument 1 is invalid
Ptr<EigenFaceRecognizer> model = EigenFaceRecognizer::create();
reconhecimento.cpp:72:35: error: ‘EigenFaceRecognizer’ is not a class, namespace, or enumeration
Ptr<EigenFaceRecognizer> model = EigenFaceRecognizer::create(); ^
reconhecimento.cpp:73:7: error: base operand of ‘->’ is not a pointer model->train(images, labels);
reconhecimento.cpp:76:29: error: base operand of ‘->’ is not a pointer
int predictedLabel = model->predict(imread(path_output+paths_out[i]+".png"));
If I change to
Ptr<BasicFaceRecognizer> model = createEigenFaceRecognizer();
The error turns to
reconhecimento.cpp:(.text+0x756): undefined reference to `cv::face::createEigenFaceRecognizer(int, double)'
reconhecimento.cpp:(.text+0x8cc): undefined reference to cv::face::FaceRecognizer::predict(cv::_InputArray const&) const'
collect2: error: ld returned 1 exit status
Someone can help me? Thanks.
I added the flag -lopencv_face, and the error turns to:
your test image must have the same size as the train images
I've solved that. Thanks everyone.