Installation
Windows 8.1 system, visual studio 2013
Dowload opencv-2.4.11.exe
Extract it to C:\local
Set the system environmental variable OPENCV_DIR C:\local\opencv\build\x86\vc12 (I set the compiler of the installed VS 2013 32 bit, i.e. the target machine is 32 bit, therefore I chose "x86" instead of "x64". Despite the fact that the computer OS is 64 bit.)
Update system environmental variable Path by adding %OPENCV_DIR%\bin
Test
Generate a new empty c++ console project
Properties of the project (under release mode)
C/C++------Additional Include Directories-------$(OPENCV_DIR)\..\..\include
Linker------Additional Library Directories------$(OPENCV_DIR)\lib
Linker------Use Library Dependency Inputs-------Yes
Linker------Input------Additional Dependencies------edit it by adding opencv_ts300.lib opencv_ts300.lib and opencv_world300.lib (for opencv-3.0.0-beta.exe)
Following is what we need for version 2.4.11
opencv_calib3d2411.lib
opencv_contrib2411.lib
opencv_core2411.lib
opencv_features2d2411.lib
opencv_flann2411.lib
opencv_gpu2411.lib
opencv_highgui2411.lib
opencv_imgproc2411.lib
opencv_legacy2411.lib
opencv_ml2411.lib
opencv_nonfree2411.lib
opencv_objdetect2411.lib
opencv_ocl2411.lib
opencv_photo2411.lib
opencv_stitching2411.lib
opencv_superres2411.lib
opencv_ts2411.lib
opencv_video2411.lib
opencv_videostab2411.lib
opencv_video2411.lib
opencv_videostab2411.lib
Properties of the project (under debug mode, the last setup is different)
C/C++------Additional Include Directories-------$(OPENCV_DIR)\..\..\include
Linker------Additional Library Directories------$(OPENCV_DIR)\lib
Linker------Input------Additional Dependencies------edit it by adding opencv_ts300.lib opencv_ts300d.lib and opencv_world300d.lib (for opencv-3.0.0-beta.exe)
opencv_calib3d2411d.lib
opencv_contrib2411d.lib
opencv_core2411d.lib
opencv_features2d2411d.lib
opencv_flann2411d.lib
opencv_gpu2411d.lib
opencv_highgui2411d.lib
opencv_imgproc2411d.lib
opencv_legacy2411d.lib
opencv_ml2411d.lib
opencv_nonfree2411d.lib
opencv_objdetect2411d.lib
opencv_ocl2411.lib
opencv_photo2411d.lib
opencv_stitching2411d.lib
opencv_superres2411d.lib
opencv_ts2411d.lib
opencv_video2411d.lib
opencv_videostab2411.lib
opencv_video2411d.lib
Test the following codes under both debug and release modes
#include <cstdio>
#include<opencv2\opencv.hpp>
void main()
{
std::cout << "OpenCV Version: " << CV_VERSION << std::endl;
}
More Test
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
using namespace std;
int main()
{
Mat img;
img = imread("Kitten1280x800.jpg", CV_LOAD_IMAGE_COLOR);
namedWindow("A kitten!", WINDOW_AUTOSIZE);
imshow("A kitten!", img);
waitKey(10000);
}