【Opencv-GPU】C++中opencv的GPU版本编译
opencv
OpenCV: 开源计算机视觉库
项目地址:https://gitcode.com/gh_mirrors/opencv31/opencv
免费下载资源
·
文章目录
- 一、安装环境
- 二、用CMake编译opencv
- 三、用CMake编译opencv_contrib
- 1. 在编译选项中进行勾选。BUILD_CUDA_STUBS、OPENCV_DNN_CUDA、WITH_CUDA、OPENCV_ENABLE_NONFREE、build_opencv_world打勾;BUILD_DOCS、BUILD_EXAMPLES、BUILD_PACKAGE、BUILD_TESTS、BUILD_PERF_TESTS、BUILD_opencv_python不打勾(可以不要这部分);
- 2. 找到编译选项OPENCV_EXTRA_MODULES_PATH,将Value设置为<path>/Opencv/opencv_contrib4.5.5/modules,然后点击configure。(过程和编译opencv的一样,失败下载的文件要补上去)
- 3. 补上缺失的文件后,点击generate
- 四、Visual Studio编译
一、安装环境
1、opencv4.5.5
2、opencv-contrib4.5.5
3、cudnn-10.2-windows10-x64-v8.2.0.53
4、cuda_10.2.0_456.43_win10
5、cmake-3.27.0-rc2-windows-x86_64.zip
安装包下载: https://pan.baidu.com/s/1d5Ht2HBLRoBBobUNxD902w
提取码:33vj
注:cuda版本和cudnn版本对应就行
cuda与cudnn的配置教程:https://zhuanlan.zhihu.com/p/99880204
二、用CMake编译opencv
1. 将cmake、opencv及opencv_contrib4.5.5放到一个文件里面,并新建一个名为build的文件夹,用于存放编译好的文件,如图4所示。
2. 运行cmake-gui.exe,并进行配置
在cmake-3.27.0-rc2-windows-x86_64\bin路径下,并在以下两个路径框中填入对应的路径。
点击configure,并设置好配置,然后点击finish
可能由于下载某些文件不成功,导致报错,这是可以通过查CMakeDownloadLog.txt,确定那些文件缺失,手动下载,补充完整之后,再点击generate。出现Configuring done 和Generating done 即可。
注: 在网站下载的文件,重新命名为相对应的名称(文件夹里面的一串数字,如上图)
下载完成后,再点击generate
三、用CMake编译opencv_contrib
1. 在编译选项中进行勾选。BUILD_CUDA_STUBS、OPENCV_DNN_CUDA、WITH_CUDA、OPENCV_ENABLE_NONFREE、build_opencv_world打勾;BUILD_DOCS、BUILD_EXAMPLES、BUILD_PACKAGE、BUILD_TESTS、BUILD_PERF_TESTS、BUILD_opencv_python不打勾(可以不要这部分);
2. 找到编译选项OPENCV_EXTRA_MODULES_PATH,将Value设置为
/Opencv/opencv_contrib4.5.5/modules,然后点击configure。(过程和编译opencv的一样,失败下载的文件要补上去)
3. 补上缺失的文件后,点击generate
四、Visual Studio编译
1. 然后点击 Open Project ,会使用之前选择的特定版本visual studio打开。
2. 选择 生成->批生成
3. 在弹出的窗口里面选择的 debug 和release的ALL_BUILD和INATALL,然后点击“生成”。
GitHub 加速计划 / opencv31 / opencv
144
15
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:3 个月前 )
d9a139f9
Animated WebP Support #25608
related issues #24855 #22569
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2 天前
09030615
V4l default image size #25500
Added ability to set default image width and height for V4L capture. This is required for cameras that does not support 640x480 resolution because otherwise V4L capture cannot be opened and failed with "Pixel format of incoming image is unsupported by OpenCV" and then with "can't open camera by index" message. Because of the videoio architecture it is not possible to insert actions between CvCaptureCAM_V4L::CvCaptureCAM_V4L and CvCaptureCAM_V4L::open so the only way I found is to use environment variables to preselect the resolution.
Related bug report is [#25499](https://github.com/opencv/opencv/issues/25499)
Maybe (but not confirmed) this is also related to [#24551](https://github.com/opencv/opencv/issues/24551)
This fix was made and verified in my local environment: capture board AVMATRIX VC42, Ubuntu 20, NVidia Jetson Orin.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [X] I agree to contribute to the project under Apache 2 License.
- [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [X] The PR is proposed to the proper branch
- [X] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2 天前
更多推荐
已为社区贡献10条内容
所有评论(0)