You are not logged in.
I'm learning Open CV right now and I am facing with a problem. I don't know which libraries should be included (or excluded if not needed) based on the OpenCV functions I use. Note that I'm using QT Creator as IDE and QT framework for the front end.
Here is an example:
I include the folowing libraries in myprogram.pro in QT Creator:
"LIBS += -lopencv_video -lopencv_core -lopencv_imgproc -lopencv_objdetect -lopencv_highgui"
but the program can't compile due to error 'undefinded reference to cv::VideoCapture()'.
After few hours I realised that opencv_videoio was the library that was missing and after including it the program compiled and it is working just fine.
So my question is: Is there anything that can be done in order to find out which libraries are missing and should be included in easy way?
Last edited by bokiscout (2016-07-25 01:35:03)
What's the object-oriented way of becoming wealthy?
- Inheritance
Offline
Hey,
in a lot of cases you can see in the way you include the headers. So in the example of opencv:
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
So in this case you will need imgproc and highgui. But the easier way to go would be to use pkg-config.
So it would look like this for opencv:
$ pkg-config --libs --cflags opencv
Output:
-I/usr/include/opencv -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
Now we have all includes and libs.
So if you only need the libs just use --libs and copy the output to your .pro file. Your compiler will not link libs you don't use.
Offline
Your compiler will not link libs you don't use.
I was'n aware of this until now, nice ti hear from you.
Actually I'm already linking the whole output of 'pkg-config --libs opencv' to compile the project but I was thinking that this is not the right (best) way to do it.
What's the object-oriented way of becoming wealthy?
- Inheritance
Offline