Hi,I am getting this error Program1.cpp|| undefined reference to `cv::face::FaceRecognizer::predict(cv::_InputArray const&) const'|

asked 2017-03-24 14:06:30 -0500

Nihar Rao gravatar image

updated 2017-03-24 14:22:07 -0500

berak gravatar image

here is my code snippet

#include <opencv2/core/core.hpp>
#include "opencv2/core.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/face/facerec.hpp"
#include "opencv2/face.hpp"
#include<bits/stdc++.h>

using namespace cv;
using namespace std;
using namespace cv::face;


/*declaration of global variables */


int image_flag=1;//flag for depicting success/failure of reading a image
CascadeClassifier face_cascade;
CascadeClassifier eyes_cascade;
String face_cascade_name, eyes_cascade_name;
vector<int> labels;
Ptr<face::FaceRecognizer> model = face::createFisherFaceRecognizer();

thanks in advance!

edit retag flag offensive close merge delete

Comments

your code snippet never calls predict(), so it's a lie.

(and somehow, you forgot to link the opencv_face lib)

berak gravatar imageberak ( 2017-03-25 02:29:04 -0500 )edit

yeah the error predict is coming as FaceRecognizer is not getting detected,I have included face.hpp

Nihar Rao gravatar imageNihar Rao ( 2017-03-25 06:33:05 -0500 )edit

can u please tell more about the the opencv_face lib

Nihar Rao gravatar imageNihar Rao ( 2017-03-25 06:33:44 -0500 )edit

check if you have -lopencv_face in your makefile or such (you added another module, you need the resp. lib)

also, os, opencv version, etc. required

berak gravatar imageberak ( 2017-03-25 06:54:02 -0500 )edit

OpenCV 3.2.0 ,windows 10 ,actually I am compiling with codeblocks ,so where should I look for makefile? Thanks

Nihar Rao gravatar imageNihar Rao ( 2017-03-25 08:05:22 -0500 )edit

I am a complete newbie ,just started working on opencv 2 days back

Nihar Rao gravatar imageNihar Rao ( 2017-03-25 08:06:30 -0500 )edit

if that's using mingw, it's probably -lopencv_face320

berak gravatar imageberak ( 2017-03-25 08:51:53 -0500 )edit

I am getting this error now i codebocks face.hpp should be buit as a c++ file

I am building it as a cpp file then why the error?

Nihar Rao gravatar imageNihar Rao ( 2017-03-26 03:49:07 -0500 )edit

sorry, but i have no idea, what you're doing there ;(

berak gravatar imageberak ( 2017-03-26 04:03:45 -0500 )edit

I noticed that face flag s not there ,how to add tat ?

Nihar Rao gravatar imageNihar Rao ( 2017-03-26 05:08:03 -0500 )edit