OPENCV 2.4.9 + CUDA 6.5 + VISUAL STUDIO 2013
根據NEIL Z. SHAO'S 指出: CUDA 5.0 並不支援vs2013…難怪我奮戰2天徒勞無功!!
如果你直接從sourceforge下載opencv2.4.9, 並不支援CUDA喔!
如果你想快速使用, 不想自己編譯的,Neil也有放在網路空間方便其他人直接下載OpenCV 2.4.9 + CUDA 6.5 + vs2013, 給他一個讚啦!!!
因為自己編譯花2個小時跑不掉,
==============================================
來驗證一下是否支援GPU, 另外不同版本OpenCV的GPU語法都會有些差異,
拿舊的專案測試一下
Visual Studio 2010開啟新專案
專案名稱: VS2010ConsoleOpenCV249GPU
加入OpenCV include path
C:\OpenCV-2.4.9\include
C:\OpenCV-2.4.9\include\opencv
連結器頁面, 點選<一般><其他程式庫目錄>
C:\OpenCV-2.4.9\lib
連結器頁面, 點選<輸入><其他相依性>
opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_ml249.lib
opencv_nonfree249.lib
opencv_objdetect249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_videostab249.lib
系統變數Path加入C:\OpenCV-2.4.9\bin
系統變數Path加入
C:\tbb43_20150316oss\bin\intel64\vc10
cudart64_65.dll找不到, 需安裝cuda 6.5
安裝cuda_6.5.14_windows_general_64
1: #include "stdafx.h"
2: #include <opencv2/opencv.hpp>
3: #include <opencv2/gpu/gpu.hpp>
4:
5: using namespace cv;
6: int _tmain(int argc, _TCHAR* argv[])
7: {
8: Mat src = imread("c:\\Porsche.jpg", 0);
9: if (!src.data) exit(1);
10: gpu::GpuMat d_src(src);
11: gpu::GpuMat d_dst;
12: //gpu::b (d_src, d_dst, -1, 50, 7);
13: gpu::Canny(d_src, d_dst, 35, 200, 3);
14: Mat dst(d_dst);
15: imwrite("out.png", dst);
16: return 0;
17: }
1:
2: #include "stdafx.h"
3: #include <opencv2/opencv.hpp>
4: #include <opencv2/gpu/gpu.hpp>
5:
6: using namespace cv;
7: int _tmain(int argc, _TCHAR* argv[])
8: {
9: Mat src = imread("c:\\Porsche.jpg", 0);
10: if (!src.data) exit(1);
11: gpu::GpuMat d_src(src);
12: gpu::GpuMat d_dst;
13: gpu::bilateralFilter(d_src, d_dst, -1, 50, 7);
14: gpu::Canny(d_dst, d_dst, 35, 200, 3);
15: Mat dst(d_dst);
16: imwrite("out.png", dst);
17: return 0;
18: }
參考資料
留言列表