Ask Your Question
0

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?

asked 2018-11-20 23:57:10 -0600

Saptami gravatar image

updated 2020-11-01 06:27:17 -0600

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.

edit retag flag offensive close merge delete

Comments

your cmdline is wrong. you should build the rgbd module together with the opencv libs, not seperately.

see the README.md there again.

berak gravatar imageberak ( 2018-11-21 00:15:24 -0600 )edit

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

saptami gravatar imagesaptami ( 2018-11-21 01:41:17 -0600 )edit

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)

I am trying to compile the source cpp files in rgbd module

this sounds wrong. you need to link your own code to opencv_rgbd, not compile the source files

berak gravatar imageberak ( 2018-11-21 01:53:26 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-22 01:14:26 -0600

Saptami gravatar image

Thanks for your clarifications.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-11-20 23:57:10 -0600

Seen: 729 times

Last updated: Nov 20 '18