Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

error in facec

hi , i am getting error in facerecognizer in opencv 2.4.10. what should i do.

below is code :

Ptr<facerecognizer> learnCollectedFaces(const vector<mat> preprocessedFaces, const vector<int> faceLabels, const string facerecAlgorithm) {

Ptr<FaceRecognizer> model;

cout << "Learning the collected faces using the [" << facerecAlgorithm << "] algorithm ..." << endl;

// Make sure the "contrib" module is dynamically loaded at runtime.
// Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run!
bool haveContribModule = initModule_contrib();
if (!haveContribModule) {
    cerr << "ERROR: The 'contrib' module is needed for FaceRecognizer but has not been loaded into OpenCV!" << endl;
    exit(1);
}

// Use the new FaceRecognizer class in OpenCV's "contrib" module:
// Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run!
model = Algorithm::create<FaceRecognizer>(facerecAlgorithm);
if (model.empty()) {
    cerr << "ERROR: The FaceRecognizer algorithm [" << facerecAlgorithm << "] is not available in your version of OpenCV. Please update to OpenCV v2.4.1 or newer." << endl;
    exit(1);
}

// Do the actual training from the collected faces. Might take several seconds or minutes depending on input!
model->train(preprocessedFaces, faceLabels);

return model;

}

error : image description

click to hide/show revision 2
No.2 Revision

error in facec

hi , i am getting error in facerecognizer in opencv 2.4.10. what should i do.

below is code :

Ptr<facerecognizer>

Ptr<FaceRecognizer> learnCollectedFaces(const vector<mat> vector<Mat> preprocessedFaces, const vector<int> faceLabels, const string facerecAlgorithm)
{

{

    Ptr<FaceRecognizer> model;

 cout << "Learning the collected faces using the [" << facerecAlgorithm << "] algorithm ..." << endl;

 // Make sure the "contrib" module is dynamically loaded at runtime.
 // Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run!
 bool haveContribModule = initModule_contrib();
 if (!haveContribModule) {
     cerr << "ERROR: The 'contrib' module is needed for FaceRecognizer but has not been loaded into OpenCV!" << endl;
     exit(1);
 }

 // Use the new FaceRecognizer class in OpenCV's "contrib" module:
 // Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run!
 model = Algorithm::create<FaceRecognizer>(facerecAlgorithm);
 if (model.empty()) {
     cerr << "ERROR: The FaceRecognizer algorithm [" << facerecAlgorithm << "] is not available in your version of OpenCV. Please update to OpenCV v2.4.1 or newer." << endl;
     exit(1);
 }

 // Do the actual training from the collected faces. Might take several seconds or minutes depending on input!
 model->train(preprocessedFaces, faceLabels);

 return model;
}

}error :

error : image description

![image description](/upfiles/1424256649300074.png)