Install opencv with VC

Source: Internet
Author: User
Tags vc9 visual studio 2010

1. VC sets the global VC ++ directory

Previous versions are all set in "tools-> options-> projects and solutions-> VC ++ directory", and change from 2010.

Open or create a 2010 Project, "View-> Property Manager", and the Property Manager dialog box is displayed. 1-1

1-1

Debug | Win32 and release | MICROSOFT. cpp. win32.user under Win32 can be set.

Double-click any one of them. The Microsoft. cpp. win32.user attribute page is displayed. Set the path of the global header file and library directory in the VC ++ directory on the left and save the settings.

Ii. Install opencv2.3.1 in vs2010

1. Environment Configuration

Hardware:
CPU: Pentium (r) dual-core CPU e6600 @ 3.06 GHz
Memory: 2 GB
Software
Operating System: Windows 7 flagship edition 32-bit
Installation environment: Visual Studio 2010 professional + opencv2.3.1

2. configuration process (based on your actual installation path)

A. Configure the global header file path D: \ Program Files \ opencv2.3.1 \ build \ include; D: \ Program Files \ opencv2.3.1 \ build \ include \ opencv; D: \ Program Files \ opencv2.3.1 \ build \ include \ opencv2

B. Configure the global library file path

    • 32-bit System & vc2008, library directory:D: \ Program Files \ opencv2.3.1 \ build \ x86 \ vc9 \ Lib
    • 32-bit System & vc2010, library directory:D: \ Program Files \ opencv2.3.1 \ build \ x86 \ VC10 \ Lib
    • 64-bit System & vc2008, library directory:D: \ Program Files \ opencv2.3.1 \ build \ x64 \ vc9 \ Lib
    • 64-bit System & vc2010, library directory:D: \ Program Files \ opencv2.3.1 \ build \ x64 \ VC10 \ Lib

C. Set Environment Variables

 We just set a dynamic library, so we also need to add the directory where the DLL file of opencv is located to the PATH environment variable. The DLL file directory is as follows:

    • 32-bit System & vc2008, dll Directory:D: \ Program Files \ opencv2.3.1 \ build \ x86 \ vc9 \ bin
    • 32-bit System & vc2010, dll Directory:D: \ Program Files \ opencv2.3.1 \ build \ x86 \ VC10 \ bin
    • 64-bit System & vc2008, dll Directory:D: \ Program Files \ opencv2.3.1 \ build \ x64 \ vc9 \ bin
    • 64-bit System & vc2010, dll Directory:D: \ Program Files \ opencv2.3.1 \ build \ x64 \ VC10 \ bin

Because some functions require TBB, you need to add the directory where TBB is located to the environment variable path. The DLL paths related to TBB are:

    • 32-bit System & vc2008:D: \ Program Files \ opencv2.3.1 \ build \ common \ TBB \ ia32 \ vc9
    • 32-bit System & vc2010:D: \ Program Files \ opencv2.3.1 \ build \ common \ TBB \ ia32 \ VC10
    • 64-bit System & vc2008:D: \ Program Files \ opencv2.3.1 \ build \ common \ TBB \ intel64 \ vc9
    • 64-bit System & vc2010:D: \ Program Files \ opencv2.3.1 \ build \ common \ TBB \ intel64 \ VC10

Iii. Programming

1. Create a project

2.Select a project in Solution Explorer, right-click the project, and select Properties

3.In [input] of [linker], add [add dependency additional dependencies] For the debug configuration of the project:Token; token; opencv_core231d.lib; token; opencv_gpu231d.lib; token; opencv_ml231d.lib; token; opencv_ts231d.lib; opencv_video231d.lib (Delete as needed)

Note: In the new editing window, add one by one, and press Enter. Do not add ";" at the end of the line. Otherwise, an error similar to the following occurs: 1> link: Fatal error lnk1104: unable to open the file "... Lib"

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.