SETUP OPENCV 2.4.9.
Overview
1. Install tool for compile OpenCV
2. Setup Environment variables for OpenCV
3. Configure in Visual Studio and simple example.
4. Result
I.
II.
Install tools for compile OpenCV
1. Visual Studio
Download and install Visual Studio 2013 or Visual Studio 2015 (C/C++).
It’s free and choosing all default options will work fine
2. OpenCV 3.1.0
Goto and download the OpenCV latest version 2.4.9 for
Windows. Then set "Extract to:" to your "C:\" directory.
Setup Environment variables for OpenCV]
Goto “My Computer”, click ringt mouse select “Properties”
Then chose “Advanced system setting”.
Then we chose
And edit “Path” field
Add “C:\opencv\build\x64\vc12\bin”. Because we are using Visual Studio 2013 (vc12)
Click “OK” to save.
Pull up a Command Prompt and verify the bin directory is now in PATH, then reboot
Configure in Visual Studio and simple example.
Start Visual Studio, choose File -> New -> Project.
Choose Visual C++, Empty Project, name as you prefer, ex “OpenCV_Test1”, set
preferred location, uncheck "Create directory for solution" and "Add to source control",
choose OK.
III.
Then right click in Solution Explorer, choose Add -> New Item.
Choose "C++ File", name the C++ file as preferred, ex. "Main.cpp", choose "Add".
In the Visual Studio toolbar, verify that "Solution Configurations" is set to "Debug",
then change "Solution Platforms" to "x64" (make sure not to skip this step, or 32-bit vs
64-bit errors will be encountered).
Chose “OpenCV_Test1”, click “Properties”
Chose “Configuration Manager”
Click “Win 32” in “Platofrom”
Chose “x64”, then click OK
•
In “VC++ Directories”,
- in “Include Directories ” field add “C:\opencv\build\include” and
- in field “Library Directories” add “C:\opencv\build\x64\vc12\lib”
•
In “C/C++” field, at “Additional Include Directories” field
Add “C:\opencv\build\include”
•
In “Linker” field.
At “Additional Include Directories” field, add “C:\opencv\build\x64\vc12\lib”
At “Input” field
Add “
opencv_calib3d249d.lib;
opencv_contrib249d.lib;
opencv_core249d.lib;
opencv_features2d249d.lib;
opencv_flann249d.lib;
opencv_gpu249d.lib;
opencv_highgui249d.lib;
opencv_imgproc249d.lib;
opencv_legacy249d.lib;
opencv_ml249d.lib;
opencv_nonfree249d.lib;
opencv_objdetect249d.lib;
opencv_ocl249d.lib;
opencv_photo249d.lib;
opencv_stitching249d.lib;
opencv_superres249d.lib;
opencv_ts249d.lib;
opencv_video249d.lib;
opencv_videostab249d.lib;”
in “Additional Dependencies” field.
“opencv_calib3d249.lib;
opencv_contrib249.lib;
opencv_core249.lib;
opencv_features2d249.lib;
opencv_flann249.lib;
opencv_gpu249.lib;
opencv_highgui249.lib;
opencv_imgproc249.lib;
opencv_legacy249.lib;
opencv_ml249.lib;
opencv_nonfree249.lib;
opencv_objdetect249.lib;
opencv_ocl249.lib;
opencv_photo249.lib;
opencv_stitching249.lib;
opencv_superres249.lib;
opencv_ts249.lib;
opencv_video249.lib;
opencv_videostab249.lib;”
(when Release mode, we remove symbol “d” in the version. Ex: opencv_calib3d249.lib)
So, we configured environment for Visual Studio.
IV.
Result
We are test with project “Trace the red” use Camera.