Errors while including "opencv2/contrib/contrib.hpp"

asked 2015-04-12 02:05:58 -0500

SnShine gravatar image

A simple DisplayImage code like this is working fine:

#include <opencv2/highgui/highgui.hpp>
// #include <opencv2/contrib/contrib.hpp>
using namespace cv;

int main()
{

    Mat img = imread("5.jpg");
    imshow("opencvtest",img);
    waitKey(0);

    return 0;
}

but showing the following error while including contrib.hpp: How to include contrib.hpp and use its functions like faceRecognizer?

SnShine : g++ -ggdb `pkg-config --cflags opencv` -o `basename opencvtest.cpp .cpp` opencvtest.cpp `pkg-config --libs opencv`
In file included from opencvtest.cpp:2:0:
/usr/local/include/opencv2/contrib/contrib.hpp:79:9: error: ‘CvHistogram’ does not name a type
         CvHistogram *fHistogram;
         ^
/usr/local/include/opencv2/contrib/contrib.hpp:90:5: error: ‘IplImage’ does not name a type
     IplImage *imgHueFrame, *imgSaturationFrame, *imgLastGrayFrame, *imgMotionFrame, *imgFilteredFrame;
     ^
/usr/local/include/opencv2/contrib/contrib.hpp:91:5: error: ‘IplImage’ does not name a type
     IplImage *imgShrinked, *imgTemp, *imgGrayFrame, *imgHSVFrame;
     ^
/usr/local/include/opencv2/contrib/contrib.hpp:94:19: error: ‘IplImage’ has not been declared
     void initData(IplImage *src, int widthDivider, int heightDivider);
                   ^
/usr/local/include/opencv2/contrib/contrib.hpp:109:26: error: ‘IplImage’ has not been declared
     virtual void process(IplImage *inputBGRImage, IplImage *outputHueMask);
                          ^
/usr/local/include/opencv2/contrib/contrib.hpp:109:51: error: ‘IplImage’ has not been declared
     virtual void process(IplImage *inputBGRImage, IplImage *outputHueMask);
                                                   ^
/usr/local/include/opencv2/contrib/contrib.hpp:208:30: error: ‘IplImage’ has not been declared
         void initDepthValues(IplImage *maskImage, IplImage *depthMap);
                              ^
/usr/local/include/opencv2/contrib/contrib.hpp:208:51: error: ‘IplImage’ has not been declared
         void initDepthValues(IplImage *maskImage, IplImage *depthMap);
                                                   ^
/usr/local/include/opencv2/contrib/contrib.hpp:210:26: error: ‘IplImage’ has not been declared
         void extractInfo(IplImage *maskImage, IplImage *depthMap, bool initDepth);
                          ^
/usr/local/include/opencv2/contrib/contrib.hpp:210:47: error: ‘IplImage’ has not been declared
         void extractInfo(IplImage *maskImage, IplImage *depthMap, bool initDepth);
                                               ^
/usr/local/include/opencv2/contrib/contrib.hpp:214:24: error: ‘IplImage’ has not been declared
         bool meanShift(IplImage *maskImage, IplImage *depthMap, int maxIteration, bool initDepth);
                        ^
/usr/local/include/opencv2/contrib/contrib.hpp:214:45: error: ‘IplImage’ has not been declared
         bool meanShift(IplImage *maskImage, IplImage *depthMap, int maxIteration, bool initDepth);
                                             ^
/usr/local/include/opencv2/contrib/contrib.hpp:247:62: error: ‘IplImage’ has not been declared
     void findOptimumSearchWindow(SearchWindow &searchWindow, IplImage *maskImage, IplImage *depthMap, int maxIteration, int resizeMethod, bool initDepth);
                                                              ^
/usr/local/include/opencv2/contrib/contrib.hpp:247:83: error: ‘IplImage’ has not been declared
     void findOptimumSearchWindow(SearchWindow &searchWindow, IplImage *maskImage, IplImage *depthMap, int maxIteration, int resizeMethod, bool initDepth);
                                                                                   ^
In file included from opencvtest.cpp:2:0:
/usr/local/include/opencv2/contrib/contrib.hpp:253:16: error: ‘IplImage’ has not been declared
     void track(IplImage *maskImage, IplImage *depthMap, int resizeMethod, bool resetSearch, int minKernelMass = MinKernelMass);
                ^
/usr/local/include/opencv2/contrib/contrib.hpp:253:37: error: ‘IplImage’ has not been declared
     void track(IplImage *maskImage, IplImage *depthMap, int resizeMethod, bool resetSearch, int minKernelMass = MinKernelMass);
                                     ^
/usr/local/include/opencv2/contrib/contrib.hpp:274:23: error: ‘vector’ does not name a type
         Octree( const vector<Point3f>& points, int maxLevels = 10, int minPoints = 20 );
                       ^
/usr/local/include/opencv2/contrib ...
(more)
edit retag flag offensive close merge delete

Comments

which opencv version is it ?

berak gravatar imageberak ( 2015-04-12 02:57:37 -0500 )edit

My believe is that it is better to only include the specific modules you need from the contrib repo. It is known that some of them are broken desperately so using that complete contrib include seems overkill.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-13 06:59:29 -0500 )edit

I confirm such a problem. I use opencv-3.0.0. I am trying to follow this tutorial: http://docs.opencv.org/2.4/modules/co..., but stuck on the problem described above.

Dmytro Prylipko gravatar imageDmytro Prylipko ( 2015-11-05 11:54:12 -0500 )edit
1

@Dmytro Prylipko , for opencv3 you will need the opencv_contrib repo , there is no contrib.hpp any more

also, please use the opencv3 tutorial, not the 2.4 one

berak gravatar imageberak ( 2015-11-05 11:59:37 -0500 )edit