Building the OpenCV 2.2 library using CMake
1. Install CMake
2. Start the CMake GUI from Start menu
3. Select:
* Where is the source code: (the directory where CMakeLists.txt in OpenCV is stored), eg: "C:\Program Files\OpenCV2.2"
* Where to build the binaries: (the directory where the OpenCV library will be built), eg: "C:\Program Files\OpenCV2.2\build"
4. Press Configure and select Visual Studio 2008 or 2010 project.
5. Enter any parameters, like if you want to build Python bindings, documentation, shared libraries, use TBB, CUDA, Eigen2 libraries, etc. (Note that TBB, 64-bit and CUDA may still be under development and therefore buggy)
6. Repeat pressing Configure until no more red rows are highlighted.
7. When ready, press Generate.
8. Open the "build" directory, where you will find your VS2008 or VS2010 "sln" file.
9. Open the sln file in VS2008 or VS2010, and Built the Solution. This should compile the OpenCV 2.2 library into the build folder.
Building your own projects using OpenCV 2.2 in Visual Studio
After you have compiled the OpenCV 2.2 library using CMake, you should configure your Visual Studio projects to use OpenCV:
1. Create your new project for C++
2. Go to project properties
3. Go to VC++ Directories
4. Add 2 new Include Directories (it's the path where you installed OpenCV, include folder):
* C:\Program Files\OpenCV2.2\include
* C:\Program Files\OpenCV2.2\include\opencv
5. Add 1 new Library Directory (it's the path where you installed OpenCV, lib folder):
* C:\Program Files\OpenCV2.2\lib
6. Go to Linker in the left menu and select Input option
7. Add these entries on Additional Dependencies option:
* C:\Program Files\OpenCV2.2\lib\opencv_core220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_highgui220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_video220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_ml220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_legacy220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_imgproc220d.lib
8. Make the content of 'OpenCV_Helloworld.cpp' as such:
#include "cv.h"等,但是備註修改為 #include "opencv2/imgproc/imgproc.hpp"
ERROR C1083
Visual C++ >>include 目錄
C:\OpenCV2.2\include\opencv;C:\OpenCV2.2\vs2010\include\;
1. Install CMake
2. Start the CMake GUI from Start menu
3. Select:
* Where is the source code: (the directory where CMakeLists.txt in OpenCV is stored), eg: "C:\Program Files\OpenCV2.2"
* Where to build the binaries: (the directory where the OpenCV library will be built), eg: "C:\Program Files\OpenCV2.2\build"
4. Press Configure and select Visual Studio 2008 or 2010 project.
5. Enter any parameters, like if you want to build Python bindings, documentation, shared libraries, use TBB, CUDA, Eigen2 libraries, etc. (Note that TBB, 64-bit and CUDA may still be under development and therefore buggy)
6. Repeat pressing Configure until no more red rows are highlighted.
7. When ready, press Generate.
8. Open the "build" directory, where you will find your VS2008 or VS2010 "sln" file.
9. Open the sln file in VS2008 or VS2010, and Built the Solution. This should compile the OpenCV 2.2 library into the build folder.
Building your own projects using OpenCV 2.2 in Visual Studio
After you have compiled the OpenCV 2.2 library using CMake, you should configure your Visual Studio projects to use OpenCV:
1. Create your new project for C++
2. Go to project properties
3. Go to VC++ Directories
4. Add 2 new Include Directories (it's the path where you installed OpenCV, include folder):
* C:\Program Files\OpenCV2.2\include
* C:\Program Files\OpenCV2.2\include\opencv
5. Add 1 new Library Directory (it's the path where you installed OpenCV, lib folder):
* C:\Program Files\OpenCV2.2\lib
6. Go to Linker in the left menu and select Input option
7. Add these entries on Additional Dependencies option:
* C:\Program Files\OpenCV2.2\lib\opencv_core220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_highgui220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_video220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_ml220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_legacy220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_imgproc220d.lib
8. Make the content of 'OpenCV_Helloworld.cpp' as such:
#include "cv.h"等,但是備註修改為 #include "opencv2/imgproc/imgproc.hpp"
ERROR C1083
Visual C++ >>include 目錄
C:\OpenCV2.2\include\opencv;C:\OpenCV2.2\vs2010\include\;
留言
張貼留言