Vc2010 configure opencv2.4.4 Library (Graphic conversion)

Source: Internet
Author: User

 

Install opencv2.4.4 in VC 2010

 

Note:

  1. Installation Platform: 32-bit XP, vs2010;
  2. Opencv 2.4.4 does not support VC 6.0;
  3. There are many installation tutorials for compiling opencv with cmake on the Internet. We recommend that you do not compile it by yourself. If there is a problem with the pre-compiled library, try to compile it by yourself.
  4. I hope you can take a good look at each part of the precautions and understand how to configure them again. Otherwise, you will not know where the error is. Pay special attention to the number of digits of your operating system and the corresponding path.
Directory [hide]
  • 1. Download opencv
  • 2. Set Environment Variables
    • 2.1 user variable settings
      • 2.1.1 set path
      • 2.1.2 create opencv variable
    • 2.2 System variable settings
      • 2.2.1 set path
  • 3. Configure vs2010
    • 3.1 preparations
    • 3.2 configure VC10
  • 4. Test Procedures
    • 4.1 4.1 program code
    • 4.2 4.2 running results
      • 4.2.1 running results under 4.2.1 and debug
      • 4.2.2 4.2.2 and release running results
  • 5 authors

 

1. Download opencv
  1. Download section http://www.opencv.org.cn/index.php/Download from this site download opencv for Windows (that is, OpenCV-2.4.4.exe files ).
  2. Decompress the OpenCV-2.4.4.exe and place it in a directory, suchC:\Program Files\OpenCV244(My unzipping directory ). The directory structure after decompression is shown in.

Ii. Set Environment Variables
Right-click my computer → properties → advanced → environment variables.

Set path in user Variables
Select path and click Edit. Add the following path at the end of the path: C:\Program Files\OpenCV244\opencv\build\x86\vc10\bin.
Note: 1. Add a semicolon (;) before the path to separate it from the previous path, but an English semicolon (;) cannot be added at the end of the path, unless you want to add a path after it; 2. You can change it to youropencv\build\x86\vc10\binPath of the folder. 3. For a 64-bit systemChange opencv \ build \ x86 \ VC10 \ bin to opencv \ build \ x64 \ VC10 \ bin.
Create opencv variable
Click new. In the displayed dialog box, set the variable name and variable value to opencv and C:\Program Files\OpenCV244\opencv\build.
Note: 1. Variable names can be defined by yourself; 2. Variable values can be modified to youropencv\buildThe path of the folder.
Set path for System Variables
Select path and click Edit. Add the following path at the end of the path: C:\Program Files\OpenCV244\opencv\build\x86\vc10\bin.
Note: 1. Add a semicolon (;) before the path to separate it from the previous path, but an English semicolon (;) cannot be added at the end of the path, unless you want to add a path after it; 2. Change it to the path of your opencv \ build \ x86 \ VC10 \ bin folder based on your situation. 3. For a 64-bit system, you can change opencv \ build \ x86 \ VC10 \ bin to opencv \ build \ x64 \ VC10 \ bin.
Note: After setting environment variables, you must restart your computer to make the settings take effect.
3. Configure vs2010
Configure vs2010 to tell VC where to find the header file and library of opencv. Open vs2010, select "Tools"> "options"> "projects and Solutions"> "VC ++ directory", and enable this option in vs2010, as shown in, the editing function is denied.

You can right-click a specific project in a specific project and choose Properties to set it. However, this setting cannot be inherited. Each project must be set separately, which is too cumbersome, therefore, a global setting that can be inherited is required as follows:
Requirement: make sure that at least one project in vs2010 is opened. Here we use the method of creating a project to facilitate subsequent testing of the program.
Preparations
1. Open vs2010, create a project → Win32 console project → complete.
2. Click View> other window> Property Manager. The result is shown in.
Configure VC10
1. Open "Debug | Win32" → "Microsoft. cpp. win32.user" from the project on the left, as shown in.
2. Double-click "Microsoft. cpp. win32.user". The window shown in is displayed.
3. Click the VC ++ directory on the left to edit the executable file directory on the right, including the Directory and library directory, and add the corresponding paths respectively.
The corresponding path is as follows:
1) executable file directory
C:\Program Files\OpenCV244\opencv\build\x86\vc10\bin
Note: 1. You can change it to the path of your opencv \ build \ x86 \ VC10 \ bin folder based on your situation. 2. If it is a 64-bit system, you can change opencv \ build \ x86 \ VC10 \ bin to opencv \ build \ x64 \ VC10 \ bin.
2) include directory
C:\Program Files\OpenCV244\opencv\build\include
C:\Program Files\OpenCV244\opencv\build\include\opencv
C:\Program Files\OpenCV244\opencv\build\include\opencv2
Note: 1. Based on your own situation, change it to the path where your opencv \ build \ include, opencv \ build \ include \ opencv, and opencv \ build \ include \ opencv2 folders are located;2. The include directory here is the include directory under the build folder. Do not select the include folder in the same root directory as the build folder.
3) database directory
C:\Program Files\OpenCV244\opencv\build\x86\vc10\lib
Note: 1. You can change it to the path of your opencv \ build \ x86 \ VC10 \ Lib folder based on your situation. 2. If it is a 64-bit system, you can change opencv \ build \ x86 \ VC10 \ Lib to opencv \ build \ x64 \ VC10 \ Lib.
4. Add Dependencies
Click "linker"> "input"> "add dependency", as shown in.
As shown in, add opencv\build\x86\vc10\libName of the Lib file in the folder:
Opencv_calib3d244d.lib
Opencv_contrib244d.lib
Opencv_core244d.lib
Opencv_features2d244d.lib
Opencv_flann244d.lib
Opencv_gpu244d.lib
Opencv_highgui244d.lib
Opencv_imgproc244d.lib
Opencv_legacy244d.lib
Opencv_ml244d.lib
Opencv_nonfree244d.lib
Opencv_objdetect244d.lib
Opencv_photo244d.lib
Opencv_stitching244d.lib
Opencv_ts244d.lib
Opencv_video244d.lib
Opencv_videostab244d.lib

 

Opencv_calib3d244.lib
Opencv_contrib244.lib
Opencv_core244.lib
Opencv_features2d244.lib
Opencv_flann244.lib
Opencv_gpu244.lib
Opencv_highgui244.lib
Opencv_imgproc244.lib
Opencv_legacy244.lib
Opencv_ml244.lib
Opencv_nonfree244.lib
Opencv_objdetect244.lib
Opencv_photo244.lib
Opencv_stitching244.lib
Opencv_ts244.lib
Opencv_video244.lib
Opencv_videostab244.lib
Note: The above library is the library file in opencv \ build \ x86 \ VC10 \ Lib. The file name is followed by the lower-case letter "D" for the debug Library (debug mode library ), if "D" does not exist, it is the release library (release mode library ). The 244 version at the end is the same as the file in your Lib. For example, the end number of the Lib file of opencv2.4.3 is 243. If the version is different, correct it to make it consistent.
4. Test the program [edit] 4.1. program code
# Include <opencv2 \ opencv. HPP> # include <iostream> using namespace CV; void main () {iplimage * SRC; src = cvloadimage ("lena.jpg"); // set lena.jpg and Lena here. place the CPP file in the same folder cvnamedwindow ("Lena", cv_window_autosize); cvshowimage ("Lena", Src); cvwaitkey (0); cvdestroywindow ("Lena "); cvreleaseimage (& SRC );}
4.2. [edit] The running results in 4.2.1 and debug.
4.2.2. Running results under release

 

Vc2010 configure opencv2.4.4 Library (Graphic conversion)

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.