Opencv2 + entry series (1): installation and testing of opencv2.4.9

Source: Internet
Author: User

Here, we assume that all the people in this article have some knowledge of the most basic concepts such as opencv and machine vision. Therefore, this article will not introduce opencv any more, instead, we will introduce the installation and testing of opencv2.4.9. In additionThis article briefly introduces how to configure opencv to configure the development environment in the shortest time.. There are too many configuration ideas on the Internet. For Baidu, you can find the desired results by using vs2012 + opencv2.4.9.

I. Environment

First, we will briefly introduce the development environment used. This article will use vs2012 to develop the C ++ program on the Windows 8.1 platform. The opencv version used is 2.4.9.

After you download version 2.4.9 from the http://opencv.org/, decompress it to the appropriate path. Here I decompress it to E: \ opencv \ 2.4.9. The decompressed file structure should be like this.

2. Start Configuration

Environment configuration is divided into several aspects

  1. Environment variable configuration;
  2. In vs, add the "include directory", "Reference Directory", and "library directory;
  3. In vs, choose connector> input to add a dependency.

Then, configure the development environment,First, make sure that the directory of opencv is E: \ opencv \ 2.4.9 (or your own directory ).

 

2.1 environment variable configuration

Choose System Properties> environment variables> system variables on the computer.

Add "E: \ opencv \ 2.4.9 \ build \ x86 \ vc11 \ bin" to the end. If your decompression path is different from mine, see modify ,.

2.2 add the "include directory", "Reference Directory", and "library directory"

Open vs2012 and create a C ++ project at will. In the properties manager of the project, find "Microsoft. CPP. win32.user ", right-click its selection attribute (both Debug and release directories have" Microsoft. CPP. win32.user ", remember to add them all ). If you cannot find property manager, choose View> other window> property manager.

 

On the open properties page, find the [VC ++ Directory], and add the following path to the [include directory] and [library Directory, (Remember to add these paths to both Debug and release ):

Include directory:

E: \ opencv \ 2.4.9 \ build \ include;

E: \ opencv \ 2.4.9 \ build \ include \ opencv;

E: \ opencv \ 2.4.9 \ build \ include \ opencv2;

Library directory:

E: \ opencv \ 2.4.9 \ build \ x86 \ vc11 \ Lib;

2.3 add Dependencies

Also, on the Microsoft. cpp. win32.user property page, choose "linker"> "input ]. In [add dependency], add the following code:

opencv_calib3d249d.libopencv_contrib249d.libopencv_core249d.libopencv_features2d249d.libopencv_flann249d.libopencv_gpu249d.libopencv_highgui249d.libopencv_imgproc249d.libopencv_legacy249d.libopencv_ml249d.libopencv_objdetect249d.libopencv_ts249d.libopencv_video249d.libopencv_calib3d249.libopencv_contrib249.libopencv_core249.libopencv_features2d249.libopencv_flann249.libopencv_gpu249.libopencv_highgui249.libopencv_imgproc249.libopencv_legacy249.libopencv_ml249.libopencv_objdetect249.libopencv_ts249.libopencv_video249.lib

  

 

:

 

This completes the configuration of the development environment.

 

Iii. Test Procedure

Create a C ++ Win32 console program and enter the following code to run the program. The result is displayed.

 1 #include "stdafx.h" 2 #include "cv.h" 3 #include "highgui.h" 4 #include <opencv2/core/core.hpp> 5 #include <iostream> 6 using namespace std; 7 using namespace cv; 8  9 int _tmain(int argc, _TCHAR* argv[])10 {11     Mat img = imread("D:\\testImg\\boldt.jpg");12     cv::namedWindow("win1");13     moveWindow("win1",200,200);14     cv::imshow("win1",img);15     waitKey();16 }

 

Iv. [loss of msvcp110.dll]

After running the program, you may be prompted with the error "missing msvcp110.dll". To solve this problem, you only need to install the vcredist of each version (because you forget the specific version, you can refer to each version here, may be version 2012 ).

Opencv2 + entry series (1): installation and testing of opencv2.4.9

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.