赞
踩
记录Windows10 系统配置OpenCV + NCNN部署环境的过程,以下为详细记录OpenCV和NCNN的编译流程
cmake下载连接,选择你要的版本的ZIP包后解压即可
在cmake\bin目录下启动 cmake-gui.exe
https://github.com/google/protobuf/archive/v3.4.0.zip下载protobuf-3.4.0,解压到指定目录
打开VS2015命令行工具,使用以下命令进行编译
cd <protobuf-root-dir>
mkdir build
cd build
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
or
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
nmake
nmake install
opencv4.5.1
opencv_contrib4.5.1
编译OpenCV需要下载一些而外的文件,但是国内网下不了,这里有网友下载好的opencv4.5.1版本的.cache文件夹,自取即可:下载链接 密码:7beq ,下载后直接将.cache放在opencv根目录下
主要修改以下几点:
查看自己N卡显卡算力网址:https://developer.nvidia.com/cuda-gpus
勾选: with_cuda、OPENCV_ENABLE_NONFREE、BUILD_opencv_world、可选:OPENCV_DNN_CUDA
不勾选:build_java、build_tests、with vtk、BUILD_opencv_python_tests、BUILD_opencv_python_bindings_generator
可多点几次Configure 直至没有报红,然后点2-3。
右键ALL_BUILD生成,等待2小时看到失败0个后在,右键INSTALL生成,编译完成后build\install里就有了编译好的opencv
从https://vulkan.lunarg.com/sdk/home下载最新版vulkan,安装到指定目录
打开VS2015命令行工具,使用以下命令进行编译
cd ncnn
mkdir -p build
cd build
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=E:/protobuf-3.4.0/build_vs2017/install/include -DProtobuf_LIBRARIES=E:/protobuf-3.4.0/build_vs2017/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=E:/protobuf-3.4.0/build_vs2017/install/bin/protoc.exe -DNCNN_VULKAN=ON -DOpenCV_DIR=E:/opencv/build ..
or
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=<protobuf-build-dir>/install/include -DProtobuf_LIBRARIES=<protobuf-build-dir>/install/lib/libprotobufd.lib -DProtobuf_PROTOC_EXECUTABLE=<protobuf-build-dir>/install/bin/protoc.exe -DNCNN_VULKAN=ON -DOpenCV_DIR=E:/opencv/build ..
nmake
nmake install
`下一篇 OpenCV + NCNN调用实例
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。