Home >Backend Development >C++ >How to Install and Configure OpenCV 2.3 in Visual Studio 2010?
Install OpenCV-2.3 in Visual Studio 2010
In this guide, we will explain how to install OpenCV-2.3 in Visual Studio 2010 (Express) correctly Install and configure OpenCV version 2.3 x86 as many users seem to have difficulty installing it correctly.
Download and unzip OpenCV
Download OpenCV-2.3.0-win-superpack.exe and execute the file to unzip all files to a file called OpenCV2.3 in the folder. This folder contains two subdirectories: build and opencv. All settings in VS2010 will reference the build directory. For convenience, we moved the OpenCV2.3 folder to the C: drive, so please pay attention to the paths suggested in this guide as yours may be different.
Create Visual Studio Project
In Visual Studio, create a new Win32 Console Application project and name it. Once completed, a new window will appear. Click the "Application Settings" tab and make sure the "Empty Project" option is selected:
Add OpenCV code
Add a new file main to the Source Files folder .cpp, and then add the following code to main.cpp:
Configure Visual Studio Project
At this point we need to configure the project so that it looks for OpenCV headers and libraries. Go to the project properties (ALT F7) and once you see the new window do the following:
Open Configuration Properties > C/C > General and edit the "Additional Include Directories" field to add the following 3 Paths (for header files):
Build and run the application
Press F7 to build the solution and you should see:
Modify PATH Environment Variables
In order to be able to execute your application, you need to modify your system's PATH environment variable to add the location of the OpenCV DLL. Add the following to the end of your PATH:
; C:OpenCV2.3buildx86vc9bin
Now you can run your application and load images just like you would with OpenCV enkelt!
The above is the detailed content of How to Install and Configure OpenCV 2.3 in Visual Studio 2010?. For more information, please follow other related articles on the PHP Chinese website!