Differences between Include Dirst - Compiled x Installed

asked 2019-11-12 11:37:28 -0600

Hello,

I have created a project using opencv and CMake. I am using the following in CMake:

find_package( OpenCV REQUIRED )
message(${OpenCV_INCLUDE_DIRS})

However, on my computer (OpenCV manually compiled) this points to /usr/local/include/opencv4. Thus, when I use #include <opencv2/core.hpp> it compiles.

I was trying to compile the project on a friends computer (Ubuntu, just apt-get install libopencv-dev). On his computer, this points to /usr/include/opencv. From what I understand, this folder is for the older c-style API, right? His computer has a /usr/include/opencv2/core.hpp, so I guess that in order to be able to #include <opencv2/core.hpp> the include dir should be /usr/include.

How should I proceed in order to ensure this works accross computers (and OS's, since one of the guys at the lab will have to run Windows)?

Thanks in advance!

edit retag flag offensive close merge delete

Comments

apt-get install libopencv-dev

this will install an older, 3. 2.x opencv version, with a different include folder structure

berak gravatar imageberak ( 2019-11-13 01:40:39 -0600 )edit

I have added on CMake requirements for 4.0.0 at least for OpenCV. However, example from older versions signal the same "opencv2/header.hpp" structure.

E.g at opencv 3.2.0 https://docs.opencv.org/3.2.0/dc/dd3/...

#include "opencv2/imgproc.hpp"
AdjustedStorm gravatar imageAdjustedStorm ( 2019-11-13 04:05:27 -0600 )edit