Ask Your Question

OpenCV FaceRec problem

asked 2016-09-16 08:09:38 -0500

Gawajn gravatar image

Hey guys, I'm using OpenCV Version 3.1. I'm trying to use the LBPHFace Class ( But it seems that im doing something wrong. When using LBPHModel->setThreshold(0.0) or LBPHModel->get histograms() i get a error telling me class cv::face::FaceRecognizer' has no member named 'setThreshod or getHsotgrams' . The code compiles and work if i dont use any of these functions.

#include "opencv2/core.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/face.hpp"
Ptr<FaceRecognizer> LBPHModel;

void LBPHLearning(holdingFaces holding){
LBPHModel = createLBPHFaceRecognizer(8,1,8,8);
LBPHModel->train(holding.images, holding.labels);
vector<Mat> histograms = LBPHModel->getHistograms();
cout << "Size of the histograms: " << histograms[0].total() << endl;}

Thanks for your help in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-16 08:20:02 -0500

berak gravatar image

you have to keep an instance of LBPHFaceRecognizer , to access LBPH specific member functions, FaceRecognizer is only the more general base class.

so, you in your program you need a :

Ptr<LBPHFaceRecognizer> LBPHModel;
edit flag offensive delete link more


thanks for this helpful and very fast answer!!!

Gawajn gravatar imageGawajn ( 2016-09-16 08:25:39 -0500 )edit

Question Tools

1 follower


Asked: 2016-09-16 08:09:38 -0500

Seen: 135 times

Last updated: Sep 16 '16