linux下darknet指定opencv4编译安装

介绍

使用的是opencv4.4,具体我安装在了自己的目录下/home/cxzx/opencv44,如下,具体安装方法可以参考:linux下安装opencv4.4.0

cxzx@ubuntu:~/opencv44$ ls
bin  include  lib  share

编译安装

需要修改darknet中的Makefile文件,指定opencv4的路径

vim Makefile

找到下面进行修改 

ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV -I/home/cxzx/opencv44/include/opencv4
CFLAGS+= -DOPENCV
LDFLAGS+= -L/home/cxzx/opencv44/lib -lopencv_ml -lopencv_objdetect -lopencv_imgproc -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_shape -lopencv_videoio -lopencv_video
#LDFLAGS+= `pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv`
#COMMON+= `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv`
endif

然后运行下面进行编译安装

make -j

 

你可能感兴趣的:(darknet)