Cmake,opencv,opencv-contribute安装
#apt可能需要更新apt update
apt install -y wget unzip
apt-get install build-essential libgtk2.0-dev libgtk-3-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
#安装cmake
apt install cmake
查看cmake
cmake -version
#下载opencv
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.0.zip
unzip opencv.zip
mv opencv-4.5.0 opencv
cd opencv
#下载opencv_contrib
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.0.zip
unzip opencv_contrib.zip
mv opencv_contrib-4.5.0 opencv_contrib
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DINSTALL_C_EXAMPLES=ON \
-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
-DBUILD_EXAMPLES=ON ..
make -j4
make install
编译opencv dnn yolov5
#配置CMakeLists.txt,放入工程
cmake_minimum_required(VERSION 2.8)
project( yolo )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( yolo main.cpp yolo.cpp )
target_link_libraries( yolo ${OpenCV_LIBS} )
在opencvdnn工程中:文章来源:https://www.toymoban.com/news/detail-706480.html
mkdir build && build
cmake ..
make -j4
./yolo
文章来源地址https://www.toymoban.com/news/detail-706480.html
到了这里,关于申威芯片UOS中opencv DNN推理的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!