help me I have a problem installation yolo

I’m not good at English, but i will try my best to understand you.

I can’t run command make

####################################################################################################

ocr@ocr-desktop:~/darknet-master$ make
chmod +x *.sh
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -fopenmp -DGPU -DCUDNN -I/usr/local/cudnn/include -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

####################################################################################################

which version of OpenCV are you using?

Thank you for contacting.

OpenCV 4.1.1

cr@ocr-desktop:~$ python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import cv2
cv2.version
‘4.1.1’

You will probably have to modify the Makefile. You can also find cflags and ldflags with opencv_version --verbose

Copy and paste them where the pkg-config flags should go in the Makefile and it may build.

If it doesn’t build with the custom version of OpenCV you can try sudo apt install libopencv-dev and that should install the default version which probably has a .pc file. Then the Makefile should just work.

Dear all use

Thanks so much

Minor update. I was wrong, and didn’t read the whole issue. There is still a cmake flag to enable pkg-config support when you build OpenCV: “-D OPENCV_GENERATE_PKGCONFIG=ON” (or YES)

I modified my build script to use the flag by default, and it seems to work, but additional testing is welcome. This way you don’t have to copy and paste the flags and pkg-config should just work.