I just use
#include <opencv2/opencv.hpp>
and things worked. May I asked why we should do like:
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/highgui/highgui.hpp>
And why here are *.hpp files but not *.h files?
Excuse me for asking for such simple questions.
.hpp
is a convention for C++ language header files. Since OpenCV has a long story of a C API in parallel of the C++ one, one can easily understand why the people writing the library chose this extension to avoid confusion.
For the global vs. small includes question, you need to recall how things work in C/C++. The header files are just copied into your .c file before compilation.
opencv.hpp
(which is some kind of umbrella since it includes all the others), all the library header files are included and thus copied into your .cpp file. This means less typing for you but in the end a bigger file for the compiler. Hence, compilation times are longer.-lopencv_core -lopencv_imgproc
if you use only the image processing module.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With