The first two days to configure OPENCV, each building a project to manually configure some things, feel too much trouble, and later found that vs can use the property sheet configuration properties, research, get the following attribute table, the content is as follows:
File name: Opencv.props(using OpenCV2.4.3)
<?xml version= "1.0" encoding= "Utf-8"? ><project toolsversion= "4.0" xmlns= "http://schemas.microsoft.com/ developer/msbuild/2003 "> <importgroup label=" propertysheets "/> <propertygroup Label=" UserMacros "/> & Lt Propertygroup><embedmanifest>false</embedmanifest> <includepath>$ (OPENCV) \include\opencv2; $ (OPENCV) \include\opencv;$ (OPENCV) \include;$ (includepath) </IncludePath> <librarypath condition= "' $ ( Platform) ' = = ' Win32 ' ">$ (OPENCV) \x86\vc10\lib;$ (librarypath) </LibraryPath> <librarypath condition=" ' $ ( Platform) ' = = ' X64 ' ">$ (OPENCV) \x64\vc10\lib;$ (LibraryPath) </LibraryPath> </PropertyGroup> < itemdefinitiongroup> <link condition= "' $ (Configuration) ' = = ' Debug ' > <additionaldependencies> ; opencv_legacy243d.lib;opencv_calib3d243d.lib;opencv_contrib243d.lib;opencv_core243d.lib;opencv_ Features2d243d.lib;opencv_flann243d.lib;opencv_gpu243d.lib;opencv_highgui243d.lib;opencV_imgproc243d.lib;opencv_legacy243d.lib;opencv_ml243d.lib;opencv_nonfree243d.lib;opencv_objdetect243d.lib;o pencv_photo243d.lib;opencv_stitching243d.lib;opencv_ts243d.lib;opencv_video243d.lib;opencv_videostab243d.lib;% ( additionaldependencies) </AdditionalDependencies> </Link> <link condition= "' $ (Configuration) ' = = ' Release ' > <additionaldependencies>opencv_legacy243.lib;opencv_calib3d243.lib;opencv_contrib243.lib ; Opencv_core243.lib;opencv_features2d243.lib;opencv_flann243.lib;opencv_gpu243.lib;opencv_highgui243.lib;o Pencv_imgproc243.lib;opencv_legacy243.lib;opencv_ml243.lib;opencv_nonfree243.lib;opencv_objdetect243.lib;o pencv_photo243.lib;opencv_stitching243.lib;opencv_ts243.lib;opencv_video243.lib;opencv_videostab243.lib;% ( additionaldependencies) </AdditionalDependencies> </Link> </ItemDefinitionGroup> <itemgroup/ ></Project>
How to use:
1. Set environment variables, see this blog another blog post: VS2010 + OpenCV2.4.3 configuration steps
2. Create a project, in the property manager, right-click the project name--Add an existing property sheet, select Opencv.props OK
How to modify:
1.OpenCV version is different: The OPENCV version used in this example is 2.4.3, corresponding to the end of Lib library is 243, the other version can be modified accordingly
2.VS version different: VC10 for vs2010, other versions corresponding modified: VC8 (2005), VC9 (+), VC10 (2013),VC11 (+), VC12
3. Target compiler platform is different: This example is vs default Win32 platform (Win7 32-bit and 64-bit can be used), if the project is not to choose x64, need to change two places:
(1) Change the path of the environment variable to x64 (e.g. D:\OpenCV243\build\x64\vc10\bin)
(2) Remove this line from the configuration table:
<librarypath condition= "' $ (Platform) ' = = ' Win32 '" >$ (OPENCV) \x86\vc10\lib;$ (LibraryPath) </LibraryPath>
Use VS2010 's property sheet to automatically configure OpenCV