Ask Your Question

Revision history [back]

With this include

#include <opencv2/opencv.hpp>

your compiler will include everything you have selected in CMake (except opencv_contrib modules) : // File that defines what modules where included during the build of OpenCV // These are purely the defines of the correct HAVE_OPENCV_modulename values

include "opencv2/opencv_modules.hpp"

// Then the list of defines is checked to include the correct headers // Core library is always included --> without no OpenCV functionality available

include "opencv2/core.hpp"

// Then the optional modules are checked
#ifdef HAVE_OPENCV_CALIB3D
#include "opencv2/calib3d.hpp"
#endif
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d.hpp"
#endif
#ifdef HAVE_OPENCV_FLANN
#include "opencv2/flann.hpp"
#endif....

If you don't care of time compliation you can do like that. If you want to compile faster you should do like this :

#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"

You have to choose now

With this include include

#include <opencv2/opencv.hpp>

your compiler will include everything you have selected in CMake (except opencv_contrib modules) : :

// File that defines what modules where included during the build of OpenCV
// These are purely the defines of the correct HAVE_OPENCV_modulename values

values #include "opencv2/opencv_modules.hpp"

include "opencv2/opencv_modules.hpp"

// Then the list of defines is checked to include the correct headers // Core library is always included --> without no OpenCV functionality available

include "opencv2/core.hpp"

available
#include "opencv2/core.hpp"
// Then the optional modules are checked
#ifdef HAVE_OPENCV_CALIB3D
#include "opencv2/calib3d.hpp"
#endif
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d.hpp"
#endif
#ifdef HAVE_OPENCV_FLANN
#include "opencv2/flann.hpp"
#endif....

If you don't care of time compliation you can do like that. If you want to compile faster you should do like this :

#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"

You have to choose now