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](/upfiles/1424256649300074.png)
first make sure, you 'really' link to opencv_contrib2410.lib.
then, you probably should avoid the Algorithm::create functionality anyway. it's no more supported in opencv3.0, and the day you'll have to adapt to that is close.
rather skip the
initModule_contrib()
function, and build your own factory similar to:still getting the same error
now this is my code :
why i am getting the same error. i have included
these header files
now repeat 5 times LINKER LINKER LINKER LINKER LINKER
how should i do it. i didn't get it.
ok, (and sorry for pulling your leg).
this is a linker error, not a compiler one, nothing to do with c++ headers above
you have to make sure, that opencv_contrib2410.lib is in your library list. (again, linker settings)
i have already included opencv_contrib2410 into my linker.
ok. you won't need the initModule_contrib() function now, got rid of it ?
i already removed initModule_contrib(); funtion and converted the create function as you told . but still i am getting same error