第一步,配置软件源:在/etc/apt目录下的sources.list文件中添加以下源
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server main restricted universe multiverse
第二步,安装依赖项:
sudo apt-get update
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config
sudo apt-get install cmake
第三步:下载并配置opencv2.4版
cd opencv2.4
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_V4L=ON -D WITH_OPENMP=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D WITH_LIBV4L=ON -D WITH_OPENGL=ON -D WITH_FFMPEG=ON -D WITH_TBB=ON -D INSTALL_C_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D BUILD_PYTHON_SUPPORT=ON -D BUILD_OPENEXR=ON ..
make -j8
make install
若采用opencv3以上,容易出现以下错误:
/usr/bin/ld: /usr/local/lib/libopencv_core.a(opencl_core.cpp.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
在配置opencv之前,最好将java相关文件卸载,以免出现以下问题:
?第四步:下载并配置最新版darknet,makefile如下所示
cd darknet
make -j8
?第五步,下载yolov4权重,采用如下指令运行检测
./darknet detector demo cfg/coco.data cfg/yolov4.cfg backup/yolov4.weights data/test.mkv
若出现以下问题,需要配置一下opencv
error while loading shared libraries: libopencv_core.so.2.4: cannot open shared object file: No such file or directory
在/etc/ld.so.conf.d/目录下创建opencv.conf文件,在文件中添加opencv路径:/usr/local/lib
此外,有可能出现以下问题:
Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "canberra-gtk-module"
需要运行以下指令安装依赖项
sudo apt-get install overlay-scrollbar
sudo apt-get install overlay-scrollbar-gtk2
sudo apt-get install libcanberra-gtk-module
|