安裝步驟:
參考了一些資料後,稍微整理一下。
以下步驟不一定對於每台環境適用,不過可以參考看看。
(一)下載openCV2.3.1.exe 或zip後並解壓縮,並放置到需要的路徑下
如本人放置在C:\Program Files下:opencv2.3資料夾
(二)設定環境參數:
------------------------------------------
為了避免若未來專案有挪到別的環境,且其他環境的openCV資料夾放置於其它路徑導致設定的路徑都要做修改照成許多不便。因此在環境變數的使用者變數多加一個名為openCV的變數並把openCV資料夾的路徑指定下去,如此以後只需設環境變數一個步驟及可,省去許多麻煩。
1.系統 ->進階系統設定 -> 進階 -> 環境變數
2.新增->名稱OpenCV 路徑C:\Program Files\opencv2.3\

若不想採用此方法,則之後造原本方式把全部路徑打出及可。
(三)在VS2010專案下加入:
----------------------------------------
1.openCV執行檔:
專案->XXX專案屬性->進去後專案屬性->偵錯->環境
打入PATH:$(OpenCV)build\x86\vc10\bin $(OpenCV)為環境變數
若未使用前述方法則是打入:C:\Program Files\opencv2.3\build\x86\vc10\bin

基本上不採用加在系統變數path中,因系統變數會去最後才尋找,會費時,不建議。

----------------------------------------
2.include檔加入:
方法A:
$(OpenCV)build\include
$(OpenCV)build\include\opencv
$(OpenCV)build\include\opencv2

方法B:
只加入 $(OpenCV)build\include
然後另兩個路徑改成:
coding時在include中手動多加opencv\xx.h 及opencv2\xx.h

兩種方式皆可,選其中一項。
----------------------------------------
3.程式庫檔加入
$(OpenCV)build\x86\vc10\lib
下圖:

-----------------------------
(四).連結器->輸入->其他相依性,加入(不一定全部會用到)
opencv_core231d.lib
opencv_imgproc231d.lib
opencv_highgui231d.lib
opencv_ml231d.lib
opencv_video231d.lib
opencv_features2d231d.lib
opencv_calib3d231d.lib
opencv_objdetect231d.lib
opencv_contrib231d.lib
opencv_legacy231d.lib
opencv_flann231d.lib
下圖:

-----------------------------------------
(六).tbb_debug.dll 遺失問題
會有遺失的原因是因為我們通常編譯時採用debug組態,所以專案需用到tbb_debug.dll。
雖然common資料夾下有tbb資料夾,但不會有tbb_debug.dll
tbb_debug.dll不會預先放置在openCV2.3.1
須另外下載檔案->此來源網址:回報遺失tbb_debug.dll
解壓縮後 tbb30_20100406oss資料夾
把此資料夾放置 C:\Program Files\opencv2.3\build\common底下

再次設定在環境變數->使用者變數加入
名稱tbb 路徑:C:\Program Files\opencv2.3\build\common\tbb30_20100406oss\
之後重新開啟Vs2010,並再次到專案屬性->偵錯->環境
加入$(tbb)bin\ia32\vc10
(完)
--------------------------------------------------------------
參考資料:
回報遺失tbb_debug.dll
http://blog.lehu.shu.edu.cn/byman/A345078.html (下載tbb_debug.dll 檔案的來源)
Opencv 2.3.1 Installation(64bit)
http://areshopencv.blogspot.com/2011/10/opencv-231-installation.html