tum-vision / fastfusion

Volumetric 3D Mapping in Real-Time on a CPU
GNU General Public License v2.0
561 stars 173 forks source link

opencv2 dependencies (?) #22

Open constructive-realities opened 6 years ago

constructive-realities commented 6 years ago

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 commented 6 years ago

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.

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