OpenCV3.1 & opencv_contrib3.1 install in Ubuntu

asked 2017-09-28 03:27:47 -0500

updated 2017-09-28 03:59:34 -0500

berak gravatar image

I tried to setup opencv with opencv_contrib in an Ubuntu machine but failed several times. This is what I did.

  1. I downloaded the opencv3.1.0 from here

  2. I downloaded opencv_contrib3.1 from here

  3. Extracted both of them

  4. Create a build directory inside opencv3.1.0
  5. Switched to that build directory
  6. Run cmake like:

    cmake -D WITH_TBB=ON -D INSTALL_C_EXAMPLES=ON -D WITH_EIGEN=OFF -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH= opencv_contrib3.1.0_full_path/modules ..

  7. Run >make

  8. Run >sudo make install

After all of this, I saw that in the directory /usr/local/lib there were all opencv3.1 modules, but not the opencv_contrib3.1 modules like "xfeature2d"

So, when I wanted to run a simple code that uses xfeature2d (example) I don't now where is that feature located to add it in my libs path so my IDE can compile the #include "opencv2/xfeatures2d.hpp" without error.

Where are these contrib_modules supposed to be stored after make?

-- Detected version of GNU GCC: 48 (408)
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- Could NOT find JPEG (missing:  JPEG_LIBRARY JPEG_INCLUDE_DIR) 
-- Could NOT find Jasper (missing:  JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.8") 
-- Could NOT find PNG (missing:  PNG_LIBRARY PNG_PNG_INCLUDE_DIR) 
-- checking for module 'gtk+-3.0'
--   package 'gtk+-3.0' not found
-- checking for module 'gtk+-2.0'
--   package 'gtk+-2.0' not found
-- checking for module 'gthread-2.0'
--   package 'gthread-2.0' not found
-- checking for module 'gstreamer-base-1.0'
--   package 'gstreamer-base-1.0' not found
-- checking for module 'gstreamer-video-1.0'
--   package 'gstreamer-video-1.0' not found
-- checking for module 'gstreamer-app-1.0'
--   package 'gstreamer-app-1.0' not found
-- checking for module 'gstreamer-riff-1.0'
--   package 'gstreamer-riff-1.0' not found
-- checking for module 'gstreamer-pbutils-1.0'
--   package 'gstreamer-pbutils-1.0' not found
-- checking for module 'gstreamer-base-0.10'
--   package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-video-0.10'
--   package 'gstreamer-video-0.10' not found
-- checking for module 'gstreamer-app-0.10'
--   package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-riff-0.10'
--   package 'gstreamer-riff-0.10' not found
-- checking for module 'gstreamer-pbutils-0.10'
--   package 'gstreamer-pbutils-0.10' not found
-- checking for module 'libdc1394-2'
--   package 'libdc1394-2' not found
-- checking for module 'libdc1394'
--   package 'libdc1394' not found
-- checking for module 'libv4l1'
--   package 'libv4l1' not found
-- checking for module 'libv4l2'
--   package 'libv4l2' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- checking for module 'libavcodec'
--   package 'libavcodec' not found
-- checking for module 'libavformat'
--   package 'libavformat' not found
-- checking for module 'libavutil'
--   package 'libavutil' not found
-- checking for module 'libswscale'
--   package 'libswscale' not found
-- checking for module 'libavresample'
--   package 'libavresample' not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- checking for module 'libgphoto2'
--   package 'libgphoto2 ...
(more)
edit retag flag offensive close merge delete

Comments

please rather use current 3.3, not 3.1

berak gravatar imageberak ( 2017-09-28 03:29:23 -0500 )edit

we would need to see the cmake output for further diagnosis, please add that to your question

berak gravatar imageberak ( 2017-09-28 03:30:26 -0500 )edit

@berak I uploaded the cmake output here: https://files.fm/u/xzzceemm

Dionis Beqiraj gravatar imageDionis Beqiraj ( 2017-09-28 03:49:34 -0500 )edit

next time, please EDIT your question, and put it there, not on some drop bin, please

berak gravatar imageberak ( 2017-09-28 03:58:31 -0500 )edit

as you can see from the "to be build" section, none of the extra modules were built at all. (they would also show up in the same /usr/local/lib folder. )

something about your

-D OPENCV_EXTRA_MODULES_PATH= opencv_contrib3.1.0_full_path/modules

line is wrong. go again there, rerun cmake, rinse and repeat, until the extra modules show up in the "to be built" output.

only then restart make.

berak gravatar imageberak ( 2017-09-28 04:10:41 -0500 )edit

@berak Do you have any idea what might cause the problem? Is there any dependency that should be installed in the machine that I'm missing?

Dionis Beqiraj gravatar imageDionis Beqiraj ( 2017-09-28 04:20:36 -0500 )edit

hhm, at the moment, i'd say - your commandline is wrong, simply.

berak gravatar imageberak ( 2017-09-28 04:21:35 -0500 )edit