opencv+vs2013 Property sheet Configuration

Source: Internet
Author: User

Introduction

More and more computer vision tasks rely on the famous open source computer Vision Library OpenCV. OpenCV 2.0 contains a series of well-designed data structures and optimized visual algorithms that allow you to develop a good visual application in a short time. OPENCV supports a variety of different hardware and software platforms, which is an important reason for its widespread application. The development of the OPENCV program using C + +, you need to tell the compiler, the connector corresponding header file directory , library files to the library file directory , in the development of different projects, each time to specify the three items to operate a little trouble, This article introduces a way to simplify the configuration process by adding attribute tables and merging debug environment variables for opencv+vs2013 .

The specific conditions tested in this article are:

OpenCV Version Configuration Platform
2.4.10 Debug, Release x64, Win32
2.4.11 Debug, Release x64, Win32
2.4.12 Debug, Release x64, Win32
3.0.0 Debug, Release x64, Win32
Prepare OpenCV

Download the appropriate version on OPENCV's official website (tested here for 2.4.10,2.4.11,2.4.12,3.0.0 four versions). Once the download is complete, double-click the appropriate EXE file and it will self-extract to the directory you specified. Find the build directory under the extracted directory, copy all the contents of this directory to a fixed directory, the future development will refer to this directory, so it is best to choose storage location carefully. For example, I will store all the contents of the OpenCV2.4.10 K:\OpenCV\2.4.10 build directory in this directory, ( the following configuration process will take this directory as an example ),

Convert VC12, VC11, and VC10 in the x64 and x86 two directories to vc12.0, vc11.0, and vc10.0 respectively

property sheet

Take 2.4.10 as an example. Create a new text file and rename it to "Opencv_2.4.10.props" (without the quotation marks). Edit with Notepad and copy the following:

<?xml version= "1.0" encoding= "Utf-8"?><Project ToolsVersion="4.0" xmlns="http// schemas.microsoft.com/developer/msbuild/2003 ">  <importgroup Label="PropertySheets" />  <PropertyGroup>        <includepath>K:\OPENCV\2.4.10\INCLUDE\OPENCV; k:\opencv\2.4.10\include;$ (Includepath)</includepath>     <LibraryPath>K:\OpenCV\2.4.10\$ (Platformshortname) \vc$ (visualstudioversion) \lib;$ (LibraryPath)</LibraryPath>    </PropertyGroup>  <itemdefinitiongroup>    <Link Condition="' $ (Configuration) ' = = ' Debug '>      <additionaldependencies>Opencv_calib3d2410d.lib;opencv_contrib2410d.lib;opencv_core2410d.lib;opencv_features2d2410d.lib;opencv_ Flann2410d.lib;opencv_gpu2410d.lib;opencv_highgui2410d.lib;opencv_imgproc2410d.lib;opencv_legacy2410d.lib;o Pencv_ml2410d.lib;opencv_nonfree2410d.lib;opencv_objdetect2410d.lib;opencv_ocl2410d.lib;opencv_photo2410d.lib ; opencv_stitching2410d.lib;opencv_superres2410d.lib;opencv_ts2410d.lib;opencv_video2410d.lib;opencv_ videostab2410d.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>    <Link Condition="' $ (Configuration) ' = = ' Release '>      <additionaldependencies>Opencv_calib3d2410.lib;opencv_contrib2410.lib;opencv_core2410.lib;opencv_features2d2410.lib;opencv_ Flann2410.lib;opencv_gpu2410.lib;opencv_highgui2410.lib;opencv_imgproc2410.lib;opencv_legacy2410.lib;opencv_ Ml2410.lib;opencv_nonfree2410.lib;opencv_objdetect2410.lib;opencv_ocl2410.lib;opencv_photo2410.lib;opencv_ stitching2410.lib;opencv_superres2410.lib;opencv_ts2410.lib;opencv_video2410.lib;opencv_videostab2410.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>  </itemdefinitiongroup> </Project>

After saving the Opencv_2.4.10.props, close the file.

project Configuration

Create a new WIN32 console project (WIN32 console application). In the property manager, add the property sheet that you just saved. All different configurations can use the same property sheet because the property sheet handles all cases.

Note: If the property sheet and the project are under the same partition, the project file will use a relative path. As a result, the project cannot be loaded correctly after copying the project to a different directory. Therefore, it is recommended to put the property sheet to a specific partition, the project directory is best not in the same partition as the property sheet.

executing the post-compilation program

After the compilation succeeds, you may be prompted that a DLL cannot be found. Copy the following to the project's "Properties –> Debug –> environment".

PATH=K:\OpenCV\2.4.10\$(PlatformShortName)\vc$(VisualStudioVersion)\bin;$(PATH) $(LocalDebuggerEnvironment)
Additional: Property sheets for several other versions
<?xml version= "1.0" encoding= "Utf-8"?><Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/ developer/msbuild/2003 ">  <importgroup Label="PropertySheets" />  <PropertyGroup>        <includepath>K:\OPENCV\2.4.11\INCLUDE\OPENCV; k:\opencv\2.4.11\include;$ (Includepath)</includepath>     <LibraryPath>K:\OpenCV\2.4.11\$ (Platformshortname) \vc$ (visualstudioversion) \lib;$ (LibraryPath)</LibraryPath>    </PropertyGroup>  <itemdefinitiongroup>    <Link Condition="' $ (Configuration) ' = = ' Debug '>      <additionaldependencies>Opencv_calib3d2411d.lib;opencv_contrib2411d.lib;opencv_core2411d.lib;opencv_features2d2411d.lib;opencv_ Flann2411d.lib;opencv_gpu2411d.lib;opencv_highgui2411d.lib;opencv_imgproc2411d.lib;opencv_legacy2411d.lib;o Pencv_ml2411d.lib;opencv_nonfree2411d.lib;opencv_objdetect2411d.lib;opencv_ocl2411d.lib;opencv_photo2411d.lib ; opencv_stitching2411d.lib;opencv_superres2411d.lib;opencv_ts2411d.lib;opencv_video2411d.lib;opencv_ videostab2411d.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>    <Link Condition="' $ (Configuration) ' = = ' Release '>      <additionaldependencies>Opencv_calib3d2411.lib;opencv_contrib2411.lib;opencv_core2411.lib;opencv_features2d2411.lib;opencv_ Flann2411.lib;opencv_gpu2411.lib;opencv_highgui2411.lib;opencv_imgproc2411.lib;opencv_legacy2411.lib;opencv_ Ml2411.lib;opencv_nonfree2411.lib;opencv_objdetect2411.lib;opencv_ocl2411.lib;opencv_photo2411.lib;opencv_ stitching2411.lib;opencv_superres2411.lib;opencv_ts2411.lib;opencv_video2411.lib;opencv_videostab2411.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>  </itemdefinitiongroup> </Project>
<?xml version= "1.0" encoding= "Utf-8"?><Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/ developer/msbuild/2003 ">  <importgroup Label="PropertySheets" />  <PropertyGroup>        <includepath>K:\OPENCV\2.4.12\INCLUDE\OPENCV; k:\opencv\2.4.12\include;$ (Includepath)</includepath>     <LibraryPath>K:\OpenCV\2.4.12\$ (Platformshortname) \vc$ (visualstudioversion) \lib;$ (LibraryPath)</LibraryPath>    </PropertyGroup>  <itemdefinitiongroup>    <Link Condition="' $ (Configuration) ' = = ' Debug '>      <additionaldependencies>Opencv_calib3d2412d.lib;opencv_contrib2412d.lib;opencv_core2412d.lib;opencv_features2d2412d.lib;opencv_ Flann2412d.lib;opencv_gpu2412d.lib;opencv_highgui2412d.lib;opencv_imgproc2412d.lib;opencv_legacy2412d.lib;o Pencv_ml2412d.lib;opencv_nonfree2412d.lib;opencv_objdetect2412d.lib;opencv_ocl2412d.lib;opencv_photo2412d.lib ; opencv_stitching2412d.lib;opencv_superres2412d.lib;opencv_ts2412d.lib;opencv_video2412d.lib;opencv_ videostab2412d.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>    <Link Condition="' $ (Configuration) ' = = ' Release '>      <additionaldependencies>Opencv_calib3d2412.lib;opencv_contrib2412.lib;opencv_core2412.lib;opencv_features2d2412.lib;opencv_ Flann2412.lib;opencv_gpu2412.lib;opencv_highgui2412.lib;opencv_imgproc2412.lib;opencv_legacy2412.lib;opencv_ Ml2412.lib;opencv_nonfree2412.lib;opencv_objdetect2412.lib;opencv_ocl2412.lib;opencv_photo2412.lib;opencv_ stitching2412.lib;opencv_superres2412.lib;opencv_ts2412.lib;opencv_video2412.lib;opencv_videostab2412.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>  </itemdefinitiongroup> </Project>
<?xml version= "1.0" encoding= "Utf-8"?><Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/ developer/msbuild/2003 ">  <importgroup Label="PropertySheets" />  <PropertyGroup>        <includepath>K:\OPENCV\3.0.0\INCLUDE\OPENCV; k:\opencv\3.0.0\include;$ (Includepath)</includepath>       <LibraryPath>K:\OpenCV\3.0.0\$ (Platformshortname) \vc$ (visualstudioversion) \lib;$ (LibraryPath)</LibraryPath>     </PropertyGroup>  <itemdefinitiongroup>    <Link Condition="' $ (Configuration) ' = = ' Debug '>      <additionaldependencies>opencv_ts300d.lib;opencv_world300d.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>    <Link Condition="' $ (Configuration) ' = = ' Release '>      <additionaldependencies>opencv_ts300.lib;opencv_world300.lib;% ( Additionaldependencies)</additionaldependencies>    </Link>  </itemdefinitiongroup> </Project>

opencv+vs2013 Property sheet 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: 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.