Why am I getting these errors: cannot find opencv2/contrib.h , opencv2/core/private.hpp when I am trying to compile codes from opencv_contrib modules?
System information (version)
OpenCV =>opencv-4.0.0-alpha and opencv_contrib-4.0.0-alpha
Operating System / Platform => Ubuntu 16.04
Compiler and CMake => gcc 5.4.0 and cmake version 3.5.1
Detailed description
I am trying to compile the source cpp files in rgbd module of opencv_contrib-4.0.0-alpha. I am getting this error :
$ g++ -ggdb -std=c++11 depth_cleaner.cpp -o depth_cleaner pkg-config opencv4 --cflags --libs In file included from depth_cleaner.cpp:7:0: precomp.hpp:14:36: fatal error: opencv2/core/private.hpp: No such file or directory compilation terminated.
I have built opencv_contrib module following this link without any errors: https://github.com/opencv/opencv_contrib#how-to-build-opencv-with-extra-modules
But apparently no contrib.h or private.hpp file has been generated after the build process. Is this the problem with this particular version of opencv_contrib? Should I try with older opencv_contrib-3xx version?
Please help.
your cmdline is wrong. you should build the rgbd module together with the opencv libs, not seperately.
see the README.md there again.
I have used the following commands to build the contrib modules. ~/opencv-4.0.0-alpha/build$ cmake -D OPENCV_EXTRA_MODULES_PATH=/home/saptami/opencv_contrib-4.0.0-alpha/modules/ ..
$ make -j4
$ sudo make install
But opencv2/contrib.h and opencv2/core/private.hpp files are missing from the /usr/local/include/opencv4/opencv2/ path
opencv2/contrib.h does not exist (where did you find that ?) and opencv2/core/private.hpp is a package private header, that won't get installed (it's not needed outside the library)
again, you should not need any private headers to compile e.g. the rgbd samples, or your own code.
can you explain, where the g++ cmdline in your question came from ? (cmake won't generate something like that)
this sounds wrong. you need to link your own code to opencv_rgbd, not compile the source files