After some googleing I fount that the OpenCV 2.0 binaries are compiled for the MinGW Rather than Visual Studio. So to work OpenCV in visual Studio We have to compile the source for vs2005. for that we will need the software cmake2.4 and you can download and install it and download the cmake2.0.exe. after that you ve to compile it and build it.
But Luckily I found a blog that gives the vs2005 compiled version of the OpenCV 2.0. and you can download it from here. OpenCV-win32-vs2005.exe. thanx to Zerm.
Okay.. I f you downloaded it ,install it . Then take the visual studio and go to
Tools > Options and click the 'vc++ Directories' in the 'Projects and Solutions' Option and In the Drop down list of the 'Show Directories' and Select it as Include Files and add this line to it
C:\Program Files\OpenCV2.0\include\opencv
Then Select 'Library Files' and Add this
C:\Program Files\OpenCV2.0\lib
Then Select the 'Source File' and Add this Lines
C:\Program Files\OpenCV2.0\src\cv
C:\Program Files\OpenCV2.0\src\highgui
C:\Program Files\OpenCV2.0\src\cxcore
C:\Program Files\OpenCV2.0\src\ml
Now the Configuration is almost done . Now try a simple the sample code.
#include "stdafx.h"
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("Image.bmp");
cvNamedWindow("Image:", 1);
cvShowImage("Image:", img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
Before Debugging it go to the Project>>Properties>>Configuration Properties>>Linker>>Input and add the lib like this in the above snapshot. Now debug the project a prompt.It will run. This is the simplest and efficient way to get opencv Work in VS2005.
Or If you want the complex Procedure You can Follow this Link to compile the Opencv with cmake and all the stuffs click here
2 comments:
Your configuration work perfectly on my VS2005...I appreciate your article...regards
thanx dude...
Post a Comment