Ask Your Question

Revision history [back]

faceRecognizer; cannot ->set() threshold after constructed

I am trying to create a LBPH face detector and after it's created, adjust the threshold as a form of back-propagation. My problem is there does not seem to be a method in order to set the threshold after it is created. My code, as follows

    double lbphThreshold = 0.0; // This WILL change, look further below
Ptr<FaceRecognizer> model = createLBPHFaceRecognizer(1,8,8,8, lbphThreshold);

//snipped for brevity

    while (predicted == -1){
    lbphThreshold = lbphThreshold + 1.0;
    model->set("threshold", lbphThreshold);
    predicted =  model->predict(image);
    }

Eclipse reports the error as

error: ‘class cv::face::FaceRecognizer’ has no member named ‘set’
model->set("threshold", lbphThreshold);

http://docs.opencv.org/modules/contrib/doc/facerec/facerec_api.html Indicates that ->set is indeed a valid call for the object 'model'. I also tested out trying a

model->getDouble("threshold")

It too fails to be recognized as a call to model.

I've also tried model.set("threshold", lbphThreshold) which also does not work. However, the model->predict(image) does highlight as good code and no errors happen here.

I am using Eclipse in Linux, which I believe is set up correctly (can use other FaceRecognizer functions as normal). Using self-compiled OpenCV 3.0.0 with current Contrib.

Any ideas what's going on?