I cloned the repository and in the Makefile, set the OPENCV = 1 to compile with OpenCV as instructed. When I recompile the program using _make,_ I get the error below.
Keeping it by default to 0, I can _make_ the project but I cannot compile with OpenCV.
I have installed opencv for python 2.7.
Error:
gcc -Iinclude/ -Isrc/ -DOPENCV pkg-config --cflags opencv -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -c ./src/gemm.c -o obj/gemm.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
In file included from ./src/utils.h:5:0,
from ./src/gemm.c:2:
include/darknet.h:25:43: fatal error: opencv2/highgui/highgui_c.h: No such file or directory
#include "opencv2/highgui/highgui_c.h"
^
compilation terminated.
Makefile:85: recipe for target 'obj/gemm.o' failed
make: * [obj/gemm.o] Error 1
It needs to install OpenCV to operation system instead of installing opencv module in python.
OpenCV 3.4.1 and later version may has c++ compiling issue in darknet, checkout/download 3.4.0 or previous version is recommended.
Does this work for you? I'm having the exact same problem and I just followed the guide linked. It still doesn't work.
I was cloning this rep to use the YOLO object detection code but am shifting to working with darkflow : https://github.com/thtrieu/darkflow
This repo(pjreddie/darknet) is written by c, needs gcc(or c language compatible compiler) with related CUDA and OpenCV libraries and their header file in environment, to build executable binary named darknet doing training or detection.
That's why the error message shows fatal error: opencv2/highgui/highgui_c.h: No such file or directory, it is header file for c/c++ implementation which is from OpenCV open source project instead of Python's opencv package.
@kevindudeja darkflow project doesn't need this repo's source code actually, its using tensorflow implemented darknet features in Python language, using pip to install opencv and tensorflow packages should be work.
@tooyipjee That installation guide is common concept for generic linux environment, still depends on specific OS version and its dependencies, I'm using Ubuntu16.04 and following this for my environment.
@sharowyeh Thanks for clearing it out.
Most helpful comment
This repo(pjreddie/darknet) is written by c, needs gcc(or c language compatible compiler) with related CUDA and OpenCV libraries and their header file in environment, to build executable binary named
darknetdoing training or detection.That's why the error message shows
fatal error: opencv2/highgui/highgui_c.h: No such file or directory, it is header file for c/c++ implementation which is from OpenCV open source project instead of Python's opencv package.@kevindudeja darkflow project doesn't need this repo's source code actually, its using tensorflow implemented darknet features in Python language, using pip to install opencv and tensorflow packages should be work.