Error while including face.hpp file
Hi, I am working on face recognition. When i try to add face.hpp, it is showing below errors.
In file included from /usr/include/opencv2/face.hpp:51:0,
from /usr/include/opencv2/face/facerec.hpp:11,
from processImage.cpp:11:
/usr/include/opencv2/face/predict_collector.hpp:76:31: error: expected unqualified-id before ‘const’
CV_WRAP virtual bool emit(const int label, const double dist, const int state = 0); //not abstract while Python generation require non-abstract class
^~~~~
/usr/include/opencv2/face/predict_collector.hpp:76:31: error: expected ‘)’ before ‘const’
enter code here
/usr/include/opencv2/face/predict_collector.hpp:91:23: error: expected unqualified-id before ‘const’
CV_WRAP bool emit(const int label, const double dist, const int state = 0);
^~~~~
/usr/include/opencv2/face/predict_collector.hpp:91:23: error: expected ‘)’ before ‘const’
Makefile:2635: recipe for target 'processImg.o' failed
am i missing any thing else.
I added #include opencv2/face.hpp"" and i got those errors.
Thanks Tirupathi
which opencv version is it ?
do you also include Qt headers (emit) ?
your code looks outdated
I am using opencv 3.1. I could able to detect the face with my application. But when i try to implement face recognition, it is throwing errors.
I started with
cv::Ptr<cv::face::FaceRecognizer> model = cv::face::createFisherFaceRecognizer();
. It started throwing error saying face is not member of cv. Then i added face.hpp, and now i got those errors which i posted above.3.1 is terribly outdated. please update both opencv(main) and opencv_contrib to latest master, rebuild, and try again.
wont it work without opencv_contrib and without updating it. We have limitation now.
In few examples, i have seen it using but when i use it, i am getting errors.
Here is the link i took as reference https://docs.opencv.org/3.1.0/dd/d65/...
it will work, if you update it.
are you using Qt ? try to change the order of headers, or isolate the face reco code, to avoid conflicts about
emit
yes. i am using qt.
so, isolate it, so you don't have the face.hpp with your Qt code
Thanks. It worked.