Ask Your Question

build question, included opencv_contrib but doesn't find contrib.hpp

asked 2016-06-27 15:48:59 -0500

atv gravatar image

So i build this according to berak's answer (thanks!)

and all was well. I used:

git clone git clone mkdir build cd build cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ -DCMAKE_INSTALL_PREFIX=/usr/local/ -DWITH_QT=ON -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.5.1_2/ ../opencv/ make -j5 make install

But for some reason, any code that includes: include "opencv2/contrib/contrib.hpp"

does not find the contrib.hpp file. What did i do wrong? There is also no contrib directory in the /usr/local/include/opencv2/ directory, so it seems to me like it wasn't build? (sorry for the markup i

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-27 22:46:20 -0500

berak gravatar image

"opencv2/contrib/contrib.hpp" does not exist in opencv3, only in opencv2.4

you're obviously trying an older sample code, tell us, what it is, then we can help find a proper replacement

edit flag offensive delete link more


Hi berak, i'm using code based on :

atv gravatar imageatv ( 2016-06-28 01:09:10 -0500 )edit

atv, for opencv3, please use master docs, also see here

also, there are updated samples in opencv_contrib/modules/face/samples

berak gravatar imageberak ( 2016-06-28 01:23:22 -0500 )edit

Thanks, i wasn't aware of that. It doesn't look that much different. I changed the include files, i'm getting errors on compile for below. Is set labels not supported anymore?

error: no member named 'setLabelsInfo' in 'cv::face::FaceRecognizer' model->setLabelsInfo(labelsInfo); error: unknown type name 'CascadeClassifier' CascadeClassifier haar_cascade; error: use of undeclared identifier 'CV_HAAR_SCALE_IMAGE' error: no member named 'get' in 'cv::face::FaceRecognizer' Mat averageFace=model->get<mat>("mean"); error: 'Mat' does not refer to a value Mat averageFace=model->get<mat>("mean"); note: declared here class CV_EXPORTS Mat

Thanks a lot for your help, i really appreciate it.

atv gravatar imageatv ( 2016-06-28 02:18:15 -0500 )edit

I noticed that Ptr<facerecognizer> model = createFisherFaceRecognizer(0,400.0); is now Ptr<basicfacerecognizer>

Does that make a difference? For some reason it errors on CascadeClassifier but it's exactly the same as in the new code.

atv gravatar imageatv ( 2016-06-28 02:21:15 -0500 )edit
  • the CV_ enums are gone in opencv3, please usecv::CASCADE_SCALE_IMAGE
  • model->getMean() instead of model->get<Mat>("mean")

  • you need Ptr<BasicFaceRegognizer> , if you want to e.g. get the mean or eigenvectors, things not in the base FaceRecognizer interface.

berak gravatar imageberak ( 2016-06-28 02:40:49 -0500 )edit

Alright i'll try that tonight when i get back home. Thanks again.

atv gravatar imageatv ( 2016-06-28 04:09:02 -0500 )edit

I forgot to include objdetect.hpp, causing many of the errors. Only one left now: Users/alefveld/Downloads/Testingground/philip3/backup2.cpp:180:12: error: no member named 'setLabelsInfo' in 'cv::face::FaceRecognizer' model->setLabelsInfo(labelsInfo);


atv gravatar imageatv ( 2016-06-28 13:56:06 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-06-27 15:48:59 -0500

Seen: 131 times

Last updated: Jun 27 '16