Darknet: Error with when OPENCV=1

Created on 12 Mar 2019  ·  5Comments  ·  Source: pjreddie/darknet

g++ -Iinclude/ -Isrc/ -DOPENCVpkg-config --cflags opencv-DGPU -I/usr/local/cuda/include/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -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 containingopencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
./src/image_opencv.cpp:5:30: fatal error: opencv2/opencv.hpp: No such file or directory
compilation terminated.
Makefile:86: recipe for target 'obj/image_opencv.o' failed

make: * [obj/image_opencv.o] Error 1`

my opencv=3.1.0 and cuda=9.0 ,who can help me? thanks

Most helpful comment

最终sudo apt install libopencv-dev 解决

All 5 comments

pkg-config --cflags opencv
run the command to check output like "-I/usr/.../opencv". If nothing, install opencv

@lihanhui 您好, 我可以说中文么? 我看你好像是北京的

最终sudo apt install libopencv-dev 解决

执行pkg-config --cflags opencv ,不报错。并且有显示那就说明没问题。
执行 echo pkg-config --libs --cflags opencv 有输出 ,也表示没问题

I resolved it using following steps:

  1. Installed opencv using sudo apt install libopencv-dev
  2. Opened a new terminal (make sure that you are using version as installed in the 1st step using following command):
    python -c "import cv2; print(cv2.__version__);
    (In my case, bashrc was setting up env vars and another installation of opencv was active and I had to comment out relevant lines in bashrc)
  3. make after setting OPENCV=1 in Makefile
    Well not much of use, just got 2 FPS :(

Versions (other versions might also work):
Opencv: 4.2.0
No CUDA/CUDNN in use

Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheHidden1 picture TheHidden1  ·  3Comments

spaul13 picture spaul13  ·  3Comments

sayanmutd picture sayanmutd  ·  3Comments

Vikalp-Reorder picture Vikalp-Reorder  ·  3Comments

AndyZX picture AndyZX  ·  3Comments