Hello everyone.
I am trying to train a model on my computer.
However, when I am trying to make with OpenCV I get the error:
chmod +x *.sh
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/image_opencv.cpp -o obj/image_opencv.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
./src/image_opencv.cpp:15:10: fatal error: opencv2/core/version.hpp: No such file or directory
#include <opencv2/core/version.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:159: recipe for target 'obj/image_opencv.o' failed
make: *** [obj/image_opencv.o] Error 1
In python, I can import with no problem:
>>> import cv2
>>> cv2.__version__
'4.1.2'
Finally, this was combiling perfectly on Colab.
Is it an error of my openCV version? Should I downgrade to 3.4.3?
Thanks in advance.
I had this yesterday. Check that 1) you built opencv with pkg-config enabled 2) you might have a opencv4.pc in your pkg-config path. I copied mine and renamed to opencv.pc and that fixed it.
Thank you very much for your help.
Before testing your solution, I installed using sudo apt-get install libopencv-dev and it worked for me.
I post it for future reference, in case anyone else has a problem.
It happens because, by default, Darknet compiles with OpenCV 3, and you have installed OpenCV 4(opencv4).
So how to build with opencv 4 ?
Most helpful comment
Thank you very much for your help.
Before testing your solution, I installed using
sudo apt-get install libopencv-devand it worked for me.I post it for future reference, in case anyone else has a problem.