創建資料夾
例如C:\OpenCV\OpenCV2410\
可以將剛才下載的壓縮檔解壓縮至該目錄下
開啟資料夾 C:\OpenCV\OpenCV2410\opencv\build
以我的筆電64位元, 所以點開x64資料夾
C:\OpenCV\OpenCV2410\opencv\build\x64
以下為Visual Studio版本分別
- vc14: The compiler packaged with Visual Studio 2015
- vc12: The compiler packaged with Visual Studio 2013
- vc11: The compiler packaged with Visual Studio 2012
- vc10: The compiler packaged with Visual Studio 2010
如果以Visual Studio 2013為例, 應選擇vc12資料夾, 如下
1. lib 資料夾
將資料夾複製或剪下 C:\OpenCV\OpenCV2410\opencv\build\x64\vc12\lib
貼上至 C:\OpenCV\OpenCV2410\lib\x64
其中檔案名稱d結尾, 表示debug版本, 反之為release版本
同理, x86依樣畫葫蘆
將資料夾複製或剪下 C:\OpenCV\OpenCV2410\opencv\build\x86\vc12\lib
貼上至 C:\OpenCV\OpenCV2410\lib\x86
2. include資料夾
回到目錄C:\OpenCV\OpenCV2410\opencv\build\
將include資料夾複製或剪下
貼上至 C:\OpenCV\OpenCV2410, 如下
3. bin 資料夾
回到目錄C:\OpenCV\OpenCV2410\opencv\build\x64\vc12\bin
將bin資料夾複製或剪下
貼上至 C:\OpenCV\OpenCV2410\bin\x64, 如下
同理, x86依樣畫葫蘆
將資料夾複製或剪下 C:\OpenCV\OpenCV2410\opencv\build\x86\vc12\bin
貼上至 C:\OpenCV\OpenCV2410\bin\x86
最後可以刪除C:\OpenCV\OpenCV2410\opencv資料夾, 只保留bin, include, lib三個資料夾即可
4. 系統變數Path
for 64位元
新增系統變數: OpenCV2410_x64
變數值: C:\OpenCV\OpenCV2410\bin\x64
for 32位元
新增系統變數: OpenCV2410_x86
變數值: C:\OpenCV\OpenCV2410\bin\x86
系統變數Path 增加
%OpenCV2410_x86%
%OpenCV2410_x64%
參考資料:
1. What is the difference between vc10, vc11 and vc12 libraries in OpenCV?
2. https://sourceforge.net/projects/opencvlibrary/files/opencv-win/