Setup OpenCV 2.4.9 Visual Studio 2013 Win 10 1. Install tool for compile OpenCV 2. Setup Environment variables for OpenCV 3. Configure in Visual Studio and simple example. 4. Result I. Install tools for compile OpenCV 1. Visual Studio Download and install Visual Studio 2013 or Visual Studio 2015 (CC++). It’s free and choosing all default options will work fine 2. OpenCV 3.1.0 Goto http:opencv.org and download the OpenCV latest version 2.4.9 for Windows. Then set Extract to: to your C: directory. II. Setup Environment variables for OpenCV Goto “My Computer”, click ringt mouse select “Properties
Trang 1SETUP OPENCV 2.4.9.
Trang 21 Install tool for compile OpenCV
2 Setup Environment variables for OpenCV
3 Configure in Visual Studio and simple example
4 Result
Trang 3I 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 http://opencv.org/ and download the OpenCV latest version 2.4.9 for Windows Then set "Extract to:" to your "C:\" directory
II Setup Environment variables for OpenCV]
Goto “My Computer”, click ringt mouse select “Properties”
Then chose “Advanced system setting”
Trang 4Then we chose
And edit “Path” field
Trang 6Add “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
Trang 7III 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
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”
Trang 8Chose “Configuration Manager”
Trang 9Click “Win 32” in “Platofrom”
Chose “x64”, then click OK
Trang 10 In “VC++ Directories”,
- in “Include Directories ” field add “C:\opencv\build\include” and
- in field “Library Directories” add “C:\opencv\build\x64\vc12\lib”
Trang 11 In “C/C++” field, at “Additional Include Directories” field Add “C:\opencv\build\include”
Trang 12 In “Linker” field.
At “Additional Include Directories” field, add “C:\opencv\build\x64\vc12\lib”
Trang 14At “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;
Trang 15opencv_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)
Trang 18So, we configured environment for Visual Studio.
Trang 19IV Result
We are test with project “Trace the red” use Camera