close

(1) Download OpenCV2.2 from Source Forge

Download the OpenCV-2.2.0-win32-vs2010.exe 

as it already contains the libraries and the binaries required for running OpenCV.

You can untar the file into a directory named /opencv2.2/

(直接下載OpenCV-2.2.0-win32-vs2010.exe,就不用在自己編譯OpenCV2.2)

 

(2) Download and install Visual Studio 2010 express (free) on your PC.

 

(3) Once Visual Studio 2010  is installed open VC++ and select  “New Project” and choose Win32 Console Application for e.g. OpenCVTest

 

(4) Include the any relevant OpenCV code into main.cpp

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>


int main(int argc, char* argv[])
{
        IplImage *img = cvLoadImage("test.jpg");
        cvNamedWindow("Image:",1);
        cvShowImage("Image:",img);


        cvWaitKey();
        cvDestroyWindow("Image:");
        cvReleaseImage(&img);
        
        return 0;
}

 

(5) Include the following 3 directories under

Project->OpenCVTest properties->VC++ Directories->Include Directories. Click Edit

.\opencv2.2\include

.\opencv2.2\include\opencv

.\opencv2.2\include\opencv2

Click Apply and OK

 

(6) Now include the library path

Project->OpenCVTest properties->Library Directories

.\opencv2.2\lib

Click Apply and OK

 

(7) Now the last step is to include all the necessary OpenCV libraries during the linking phase

For this go to Project->OpenCVTest properties->Linker->Input->Additional Dependencies and cut and paste all the following libraries by clicking the “Edit”

opencv_calib3d220.lib
opencv_calib3d220d.lib
opencv_contrib220.lib
opencv_contrib220d.lib
opencv_core220.lib
opencv_core220d.lib
opencv_features2d220.lib
opencv_features2d220d.lib
opencv_ffmpeg220.lib
opencv_ffmpeg220d.lib
opencv_flann220.lib
opencv_flann220d.lib
opencv_gpu220.lib
opencv_gpu220d.lib
opencv_highgui220.lib
opencv_highgui220d.lib
opencv_imgproc220.lib
opencv_imgproc220d.lib
opencv_legacy220.lib
opencv_legacy220d.lib
opencv_ml220.lib
opencv_ml220d.lib
opencv_objdetect220.lib
opencv_objdetect220d.lib
opencv_ts220.lib
opencv_video220.lib
opencv_video220d.lib

 

Click Apply and Ok.

 

(8) Fix the bugs in ffmpeg (for reading videos such as *.mpg) [2]  (Optional)


(a) Download the OpenCV-2.2.0-win.zip

(b) Install CMake and build the VS2010 version Solution of OpenCV-2.2.0 [3]

(c) In Release Mode, click right on opencv_ffmpeg project and select  Properties 

(d) Linker-> Debugging->Generate Debug Info->YES (/DEBUG)-> Apply and OK

(e) Click right on opencv_ffmpeg project and build this project (Build)

(f) Copy the release version of opencv_ffmpeg220.dll (OpenCV-2.2.0\build\bin\Release) to override the original opencv_ffmpeg220.dll (OpenCV2.2\bin)




Reffered to

[1] http://gigadom.wordpress.com/2011/11/01/installing-and-using-opencv-with-visual-studio-2010-express/

[2] http://stackoverflow.com/questions/3889373/opencv-crashes-trying-to-read-a-video-with-release-build

[3] http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010_CMake



arrow
arrow
    文章標籤
    OpenCV Visual C++ 2010 Express
    全站熱搜
    創作者介紹
    創作者 trick 的頭像
    trick

    trick的部落格

    trick 發表在 痞客邦 留言(0) 人氣()