Configuration of OpenCv 2.4.2 with Microsoft Visual Studio 2010
Requirements:
Steps Required in configuration
#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("D:\\funny.jpg");
cvNamedWindow("OpenCV",1);
cvShowImage("OpenCV",img);
cvWaitKey(0);
cvDestroyWindow("OpenCV ");
cvReleaseImage(&img);
return 0;
}
- OpenCv 2.4.2
- Microsoft Visual Studio 2010
Steps Required in configuration
- Set the System path:
Add these paths to your Path Variable: follow the figure (1) and (2) given below
D:\OpenCV2.4.2\opencv\build\x86\vc10\bin
D:\OpenCV2.4.2\opencv\build\common\tbb\ia32\vc10
Replace the beginning with your install path of course. It think that you would need to replace x86 in the first path with x64 and ia32 in the second path with intel64 if you want to build a 64 bit application, although I am not sure about this. - Now we are ready to create a project with OpenCV. In Visual C++ 2010, create a new Win32 console application called OpenCVTest. Now right click the project and select Properties (see figure (3)).
On the left, choose C/C++ and edit the Additional Include Directories. Add these directories: see figure (4)
D:\OpenCV2.4.2\opencv\build\include\opencv
D:\OpenCV2.4.2\opencv\build\include - Now choose Linker and add this directory to the Additional Library Directories:
D:\OpenCV2.4.2\opencv\build\x86\vc10\lib
Again I think you need to replace x86 with x64 if you want to build a 64 bit application. - Now open the Linker group and select Input. Add these lines to the Additional Dependencies:
opencv_core242d.lib
opencv_imgproc242d.lib
opencv_highgui242d.lib
opencv_ml242d.lib
opencv_video242d.lib
opencv_features2d242d.lib
opencv_calib3d242d.lib
opencv_objdetect242d.lib
opencv_contrib242d.lib
opencv_legacy242d.lib
opencv_flann242d.lib
#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("D:\\funny.jpg");
cvNamedWindow("OpenCV",1);
cvShowImage("OpenCV",img);
cvWaitKey(0);
cvDestroyWindow("OpenCV ");
cvReleaseImage(&img);
return 0;
}