Opencv + vs2012 environment setup tutorial

Source: Internet
Author: User

1. Install opencv and.

I installed opencv2.4.10 and vs2012 on my computer.

2. Configure Environment Variables

The following uses the Win8 64-bit system as an example:

Computer-properties-advanced system settings-Environment Variables

Then in System Variables

Edit path: Add D: \ Program Files \ opencv \ build \ x86 \ vc11 \ bin (pay attention to your installation path and install it on D: \ Program Files \ opencv, according to the actual situation)

Note that vs2012 is vc11, and vs2010 is VC10.

3. Configure the vs Environment

First open a Win32 Project

Then add the include directory

Add a new project Attribute Table in debug on the right.

 

Then open the properties of the newly created Project Attribute Table.

 

Then add the include directory of opencv to the include directory.

For example, D: \ Program Files \ opencv \ build \ include

Add your own lib directory to the library directory

Example: D: \ Program Files \ opencv \ build \ x64 \ vc11 \ Lib

Then add the following to the additional dependency:

Opencv_core246d.lib
Opencv_imgproc246d.lib
Opencv_highgui246d.lib
Opencv_ml246d.lib
Opencv_video246d.lib
Opencv_features2d246d.lib
Opencv_calib3d246d.lib
Opencv_objdetect246d.lib
Opencv_contrib246d.lib
Opencv_legacy246d.lib
Opencv_flann246d.lib

Note: Version 246 represents opencv 2.4.6, which can be adjusted based on your own version.

And the success is achieved.

Iv. debugging

Enter code

 1 #include <opencv2/opencv.hpp>  2 #include <iostream> 3 using namespace cv; 4 void main() {     5     IplImage *src;    6     src = cvLoadImage("desert.jpg");    7     cvNamedWindow("bvin",CV_WINDOW_AUTOSIZE);   8     cvShowImage("bvin",src);   9     cvWaitKey(0);  10     cvDestroyWindow("bvin");11     cvReleaseImage(&src);12   13 }

 

After the input, the name in the directory is displayed desert.jpgImage

If the DLL is missing, follow these steps:

In vs2012

1. Click debug 2, then select and set 3. Enable source server support on the right side. 4. Click symbol 5 on the left side, check the Microsoft symbol server, and wait for a while!! 7. Problem Solving the end

Opencv + vs2012 environment setup tutorial

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.