Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencv2 dependencies (?) #22

Open
constructive-realities opened this issue Jan 30, 2018 · 1 comment
Open

opencv2 dependencies (?) #22

constructive-realities opened this issue Jan 30, 2018 · 1 comment

Comments

@constructive-realities
Copy link

constructive-realities commented Jan 30, 2018

Greeting. I'm trying to build fast fusion on a host with ROS kinetic installed. The instructions seem pretty straightforward, however I ran into what looks like an opencv (v2 vs v3) mismatch that I could use a few pointers on to resolve

following the readme:

cmake .

rosuser@rosvm:~/Documents/Git/fork/fastfusion$ cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /opt/ros/kinetic (found version "3.2.0") 
-- GCC Major Version is 5
-- GCC Major Version is 4
-- Number of avx2 occurrences in /proc/cpuinfo: 0
-- Compiling without AVX2 support
-- PROJECT_SOURCE_DIR is /home/rosuser/Documents/Git/fork/fastfusion
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Did not find qglviewer2, linking qglviewer-qt4
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /usr/bin/qmake (found version "4.8.7") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rosuser/Documents/Git/fork/fastfusion

and then make

rosuser@rosvm:~/Documents/Git/fork/fastfusion$ make
Scanning dependencies of target geometryfusion_aos
[  4%] Building CXX object src/fusion/CMakeFiles/geometryfusion_aos.dir/geometryfusion_aos.cpp.o
In file included from /home/rosuser/Documents/Git/fork/fastfusion/src/fusion/geometryfusion_aos.cpp:8:0:
/home/rosuser/Documents/Git/fork/fastfusion/src/fusion/geometryfusion_aos.hpp:13:30: fatal error: opencv2/opencv.hpp: No such file or directory
compilation terminated.
src/fusion/CMakeFiles/geometryfusion_aos.dir/build.make:62: recipe for target 'src/fusion/CMakeFiles/geometryfusion_aos.dir/geometryfusion_aos.cpp.o' failed
make[2]: *** [src/fusion/CMakeFiles/geometryfusion_aos.dir/geometryfusion_aos.cpp.o] Error 1
CMakeFiles/Makefile2:300: recipe for target 'src/fusion/CMakeFiles/geometryfusion_aos.dir/all' failed
make[1]: *** [src/fusion/CMakeFiles/geometryfusion_aos.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Looking online for this error, it appears to be fairly common when the host has a newer version of opencv. my search also revealed that it's non-trivial to install both versions alongside each other without breaking lots of stuff.

Is there a path here to either updating fast fusion to work out of the box with a newer version of opencv or guidance on how to satisfy the requirements withouth breaking a hosts other opencv dependencies?

I can help update the readme so that other running ros can be aware of a solution.

@MaEppl
Copy link

MaEppl commented Aug 1, 2018

I think fatal error: opencv2/opencv.hpp has nothing to do with your openCV version. It just can't find the directory. Put this into your CMakeLists.txt include_directories("PATH_TO_OPEN_CV_Installation_Folder/include"). There you should find opencv.hpp

You can install different versions of opencv alongside, but I would recommend to do that in your home directory.

  • Create an opencv-src-folder: clone into all your versions of opencv you want to use
  • Create an opencv-install-folder:
  • install opencv as normal, but change your CMAKE_INSTALL_PREFIX to your opencv-install-folder
  • now create a link to switch between the different versions of opencv in your install-folder:
    ln -s Your_Open_CV_Version opencv_link. Now you can switch between the versions by changing the destination of opencv_link
  • in CMakeLists set your CMAKE_PREFIX_PATH to your opencv_link set(CMAKE_PREFIX_PATH PathTo_opencv_link)
  • If you use find_package(OpenCV YourVersion) in CMakeLists, you always have to change it to the version you want to compile with.

I wasn't able to compile fastfusion with opencv 3.3.1, but with 3.2.0 it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants