Tuesday, December 17, 2013
Installing OpenCV 2.4.6 in Visual Studio 2012
Step 1
Download OpenCV from here
unzip and change the name of opencv to OpenCV2.4.6
add to system path:
C:\OpenCV2.4.6\build\x64\vc10\bin
Step 2:
Open Visual Studio 2012 and create a new console win32 application preferrebly uncheck the precomplied hadear and security options
Go to BUILD -> Configuration Manager
Click on Win32 and create a new x64
Step 3:
Go to Project properties and add the following :
C/C++ -> Additional Include Directories
C:\OpenCV2.4.6\build\include\opencv;C:\OpenCV2.4.6\build\include;
Linker-> General -> Additional Library Dependencies
C:\OpenCV2.4.6\build\x64\vc10\lib
Linker->Input-> Additional Dependencies
Release mode:
opencv_core246.lib
opencv_imgproc246.lib
opencv_highgui246.lib
opencv_ml246.lib
opencv_video246.lib
opencv_features2d246.lib
opencv_calib3d246.lib
opencv_objdetect246.lib
opencv_contrib246.lib
opencv_legacy246.lib
opencv_flann246.lib
for Debug mode:
opencv_core246d.lib
opencv_imgproc246d.lib
opencv_highgui246d.lib
opencv_ml246d.lib
opencv_video246d.lib
opencv_features2d246d.lib
opencv_calib3d246d.lib
opencv_objdetect246d.lib
opencv_contrib246d.lib
opencv_legacy246d.lib
opencv_flann246d.lib
Step 4
Run this small snippet
#include "stdafx.h"
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
#include <opencv2/highgui/highgui.hpp>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("image.jpg");
cvNamedWindow("Image:",1);
cvShowImage("image:",img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
Subscribe to:
Posts (Atom)