2012년 8월 6일 월요일

Installing OpenCV 2.3 for Visual Studio 2008(win7)

At first, go to below web site and download OpenCV-2.3.0-win-superpack.exe

http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/





Double click on the downloaded file to unzip OpenCV libraries.
Move the unzipped folder "OpenCV2.3" to "C:\".
In my case, I located "OpenCV2.3" folder on "C:\OpenCV2.3".
(Actually, folder location is not important, but you must remember path of folder.)

And then, Open the Visual Studio 2008 and make new empty project like below.
Choose Win32 Console Application as type. Enter its name and select the path where to create it. Then in the upcoming dialog make sure you create an empty project.






Add New Item in Source files directory. Select C++ file(.cpp) as template.


 Now, let's configure project's properties, go to Projects -> Properties...
There are two configuration mode, a 'Debug' and a 'Release', to configure for OpenCV2.3.
Firstly, select 'Debug' on configuration tab.


1. Configuration Properties->C/C++ ->General directory ->Additional Include Directories

Add additional include directories as follows:

C:\OpenCV2.3\build\include
C:\OpenCV2.3\build\include\opencv
C:\OpenCV2.3\build\include\opencv2





2. Configuration Properties -> Linker -> General -> Additional Library Directories

Add additional library directories as follows:

C:\OpenCV2.3\build\x86\vc9\lib


3. Configuration Properties -> Linker -> Input -> Additional Dependencies edit

Add libraries as follows:

opencv_calib3d230d.lib
opencv_contrib230d.lib
opencv_core230d.lib
opencv_features2d230d.lib
opencv_flann230d.lib
opencv_gpu230d.lib
opencv_haartraining_engined.lib
opencv_highgui230d.lib
opencv_imgproc230d.lib
opencv_legacy230d.lib
opencv_ml230d.lib
opencv_objdetect230d.lib
opencv_video230d.lib

4. For 'Release' mode

Do like 'Debug' mode, but when you edit Additional  Dependencies, make sure you type libraries' names except 'd'( ex) xxxx_xxx230.lib)


opencv_calib3d230.lib
opencv_contrib230.lib
opencv_core230.lib
opencv_features2d230.lib
opencv_flann230.lib
opencv_gpu230.lib
opencv_haartraining_engine.lib
opencv_highgui230.lib
opencv_imgproc230.lib
opencv_legacy230.lib
opencv_ml230.lib
opencv_objdetect230.lib
opencv_video230.lib




5. Copy dll files onto System32 directory.
Go and copy files in 'C:\OpenCV2.3\build\x86\vc9\bin' and paste into 'C:\Windows\System32'



you did it!

Let's check it works well or not.



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

using namespace cv;

int main(void)
{
Mat img;
img = imread("test.jpg");
imshow("test",img);
waitKey(0);
}






댓글 없음:

댓글 쓰기