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 -0600

Nihar Rao gravatar image

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

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 -0600 )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 -0600 )edit

can u please tell more about the the opencv_face lib

Nihar Rao gravatar imageNihar Rao ( 2017-03-25 06:33:44 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

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

berak gravatar imageberak ( 2017-03-25 08:51:53 -0600 )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 -0600 )edit

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

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

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

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