我想在macOS 10.14.1上的视频中用户yolov3进行对象检测因此,我安装了OpenCV 4.0.1
brew install opencv
更改了行
OPENCV=0
to
OPENCV=1
在darknet makefile
i然后指定了pkgconfig链接
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
和重新编译
make
g++ -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv` -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -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:5:10: fatal error: 'opencv2/opencv.hpp' file not found
#include "opencv2/opencv.hpp"
我应该了解Yolov3仅适用于OpenCV 2.0吗?
使用opencv 4,我们需要修改makefile:
从OpenCV到OpenCV4修改PKG-Config名称:
LDFLAGS+= `pkg-config --libs opencv4` -lstdc++
COMMON+= `pkg-config --cflags opencv4`
我终于发现了,yolov3确实需要OpenCV 2.0
您可以使用
找到版本brew search opencv
,然后
brew install opencv@2
将显示有关如何更新链接的信息
yolov3然后以魅力来编译并运行。
(如果情况最终向南移动,我将更新答案...)
我通过使用以下命令安装OPENCV来解决此问题
> pip install opencv-python==4.1.1.26
>
> sudo apt install libopencv-dev
参考:https://github.com/pjreddie/darknet/issues/1886#issuecomment-548454746