path: D:\program files\OpenCV2.4.6\build\x86\vc10\bin
專案的屬性設定
專案→右鍵→VC++目錄→include目錄→;D:\program files\OpenCV2.4.6\build\include
專案→右鍵→VC++目錄→程式庫目錄→;D:\program files\OpenCV2.4.6\build\x86\vc10\lib
專案→右鍵→連結器→輸入→其他相依性
→opencv_calib3d246d.lib;opencv_contrib246d.lib;opencv_core246d.lib;opencv_features2d246d.lib;opencv_flann246d.lib;opencv_gpu246d.lib;opencv_haartraining_engined.lib;opencv_highgui246d.lib;opencv_imgproc246d.lib;opencv_legacy246d.lib;opencv_ml246d.lib;opencv_nonfree246d.lib;opencv_objdetect246d.lib;opencv_photo246d.lib;opencv_stitching246d.lib;opencv_ts246d.lib;opencv_video246d.lib;opencv_videostab246d.lib;
上面的設定,用LAB的電腦測試失敗
--------------------------------------------------------------------------------------
筆電的設定,連兩次測試成功
path→;E:\WG\Research\OpenCV2.4.6\build\x86\vc10\bin;
VC++→include目錄→;E:\WG\Research\OpenCV2.4.6\build\include
VC++→程式庫目錄→;E:\WG\Research\OpenCV2.4.6\build\x86\vc10\lib
連結器→輸入→其他相依性→;opencv_core246d.lib;opencv_calib3d246d.lib;opencv_contrib246d.lib;opencv_features2d246d.lib;opencv_highgui246d.lib;opencv_imgproc246d.lib
連續兩次都測試成功
--------------------------------------------------------------------------------------
環境測試Code:
#include <iostream>
#include "opencv/cv.h"
#include "opencv/cxcore.h"
#include "opencv/highgui.h"
using namespace std;
void main(){
IplImage *img = cvLoadImage("Lenna.bmp",-1);
if(!img){
cout << "can't open image" << endl;
return;
}
cvNamedWindow("Show",CV_ WINDOW_AUTOSIZE);
cvShowImage("Show", img);
cvWaitKey(0);
cvDestroyWindow("Show");
cvReleaseImage(&img);
return;
}
--------------------------------------------------------------------------------------
可能的原因:
- OpenCV壓縮檔壞掉
- 解壓縮後,不能移動解壓縮後的路徑
隔天用筆電的設定在LAB的桌電重測:成功
- 操縱變因:
- 連結器→輸入→其他相依性:兩種都能成功
- OpenCV 解壓縮後,不能移動解壓縮後的路徑