Installation of OPENCV with the configuration in Visual Studio 2010

Source: Internet
Author: User
Tags image processing library visual studio 2010

OpenCV is a powerful graphics image processing library based on C + +, which contains many tool functions for image processing and machine learning. When used in VS, the installation and related configuration steps are as follows:

First, the installation of OPENCV

(1) Download the installation package from OpenCV's official website, http://opencv.org/downloads.html take OpenCV 2.4.10 as an example

(2) such as decompression installed in the I:software directory, the directory will be generated under the name OpenCV folder

(3) Add the last side of the computer's environment variable; I:\opencv\build\x64\vc10\bin

So that the computer can find OpenCV executable bin file path, I am a 64-bit computer, if it is 32-bit computer, replace x64 with x86

Second, the configuration of OpenCV in VS

(3) OpenCV in VS in the configuration of the global and local two ways, global mode for the system properties of VS, for all projects available, the local way is only valid for the current project configuration.

Local mode:

to create a new project in VS, add the path to the OPENCV in the project---Properties->c++ directory:

    • The executable directory adds I:\opencv\build\x64\vc10\bin, which contains many DLL files for the dynamic-link libraries of OPENCV libraries.
    • Include in directory add

I:\software\opencv\build\include

I:\software\opencv\build\include\opencv

I:\software\opencv\build\include\opencv2

Although Opencv,opencv2 is under include, these three paths are added, otherwise some. h or. hpp files will not be found. When using OpenCV in VS, you need to include these header files at the beginning of the program

#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp> 

using namespace CV;

    • Add I:\software\opencv\build\x64\vc10\lib to the library directory these lib files enable C + + to find the corresponding location when calling OpenCV DLL file, if it is a 32-bit computer to change x64 to x86

Also include the name of the corresponding LIB file in the linker-I, Project--

Opencv_core2410d.libopencv_highgui2410d.libopencv_imgproc2410d.libopencv_ml2410d.lib

For example, when we use the ML library in OpenCV, we need to add the Lib file here, add the corresponding header file in C + + code

#include <opencv2/ml/ml.hpp>

This way your C + + code can find the machine learning Library in OPENCV and call the relevant function!

    • Note that the VS project is divided into debug and realease mode, local methods to configure the different modes, and if you OPENCV installed is 64-bit, in the Project property page of the active solution platform to be changed to 64-bit to use! Otherwise the compilation can be over, the solution will be generated when the error!

Global mode:

If the local approach is to configure each project separately, it is recommended to use the global approach if you need to build many projects:

In the VS View--property manager Find the mode you want to use Debug or realease, and whether you are using Win32 or x64, Perform the same local operation in the corresponding. user file: Executable directory, include directory, add library directory, lib file add, so that each of your projects will be included by default these paths!

Installation of OPENCV with the configuration in Visual Studio 2010

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.