Development of target Detection program (i)--opencv2.4.11 environment configuration

Source: Internet
Author: User
Tags windows download

The environment used in this article

Operating system: windows_8.1_x64 (This article applies to x86 as well)

Integrated development Environment: VISUAL_STUDIO_ULTIMATE_2013

OpenCV version: opencv-2.4.11

first step , download and install OpenCV

Download on OPENCV website, I chose version 2.4.11, select this version of the Windows platform version, click Opencvfor Windows Download.

After the download is complete, double-click Opencv-2.4.11.exe to install, in fact, is a self-extracting process, select the extracted directory (installation directory), waiting for decompression completed, the first step after the completion of decompression. By the way, the OPENCV installation directory has not only a compiled binary library under the build directory, but also the official routines, documents, data, tools, and so on, in the source directory.

Second Step , Configure the environment variables

1. Enter the environment variable configuration interface

Press the Windows (logo key) +x ==> Click System ==> Click Advanced System settings in the upper-left corner ==> Click Environment Variables in the lower-right corner

See the following interface

2. In the "System Variables" box, select the "variable" named path, click "Edit" in the pop-up window to add an item in the variable value, the newly added to and before and after the path is separated by semicolons, pay attention to switch to the English method, this is the "" Installation directory \opencv\build\x86\ Vc12\bin "(does not contain quotation marks)

For example, mine is "D:\Libraries\opencv\build\x86\vc12\bin",

x86 corresponds to 32-bit compilation, x64 corresponds to 64-bit compilation

VC10 corresponding to vs2010, vc11 corresponds to VS2012,VC12 corresponding vs2013

Click OK, click OK, click OK, and then click OK to exit.

You can enter the "Opencv_createsamples.exe" check on the command line to see if the configuration is successful, such as information indicating that the system has been found based on the path variable D:\Libraries\opencv\build\x86\vc12\ The Opencv_createsamples.exe program under the Bin directory, the environment variable is configured successfully.

Step three, configure the project

1. New Blank Project

① left Corner "file" = = "new" = = "click" Project "to pop up the new window;

② expand "template" = = "Expand Visual C + +" to find "blank item" = = "Fill in the project name = =" Click OK, as shown in

③ top Right Corner "solution Resource Scheme Manager" = = Right click "source file" = = "add" = = "click" New Item "=" In the pop-up window, select the. cpp file, fill in the name, such as main.cpp== "" OK "

2. Configure the Engineering Catalog

① "Resolve Explorer" = "click Project name to select, right-click = =" Properties "= =" to expand the configuration properties as shown in

② Click "VC + + Directory" = = "Include directory" click "Edit" = "Add the following 3 items, and" OK "

Double-click in the blank, then click on the Red circle button, browse your directory, find the installation directory \OPENCV\BUILD\INCLUDE,\OPENCV\BUILD\INCLUDE\OPENCV, \opencv\build\include\ OPENCV2, select the folder you want to include, operate 3 times, as shown in the 2 figure below

③ Click "VC + + Directory" = "Library Directory" click "edit" = = "Add 1 items, and" OK ", similar to the previous step, this time added is" Installation directory \opencv\build\x86\vc12\lib "folder

④ Expand "connector" = = "input" = = "Additional Dependencies" = = "Edit" Add link library is

"Install directory \opencv\build\x86\vc12\lib" in the name of all the libraries, where "XXXd.lib" form the name is the debug version, the other LIB file is Realease version, Debug version and Realease version added when separated, across a line, looking refreshed,,,

Well, the document is quite a lot, so do ...

1. "Windows+r" = "Enter" cmd, and then "enter". Bring up the command line.

2. Enter this line (D:\Libraries Replace with your installation directory)

Dir/b d:\libraries\opencv\build\x86\vc12\lib\*2411d.lib >./desktop/libname.txt


3. Enter this line again

Dir/bd:\libraries\opencv\build\x86\vc12\lib\*2411.lib >>./desktop/libname.txt


Then open the Libname.txt file on the desktop, check, 38 lines, right, copy to "Additional dependencies" can be.

This completes the project configuration.

3. Write a code test

Open the Main.cpp file you created before, paste the following into it, run it, or go to the installation directory to find an official C + + example, put the code in, can be compiled successfully.

#include <cv.h> #include 


Well, it's not about this, this error message is probably because there are no 64-bit libraries that can be ignored first,

The real reason is the path name is wrong, no escape ' \ ', plus just fine, after the modification

Run successfully

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Development of target Detection program (i)--opencv2.4.11 environment configuration

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: 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.