首页 > 代码库 > opencv vs环境配置

opencv vs环境配置

1.新建环境变量 OPENCV = D:\Programss\opencv\build

2.%OPENCV%\x86\vc12\bin;加入Path环境变量

3.导入 VS属性表文件 cv2413.props 到工程,避免重复配置lib

<?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" />  <PropertyGroup>        <IncludePath>$(OPENCV)\include;$(IncludePath)</IncludePath>        <LibraryPath Condition="‘$(Platform)‘==‘Win32‘">$(OPENCV)\x86\vc12\lib;$(LibraryPath)</LibraryPath>        <LibraryPath Condition="‘$(Platform)‘==‘X64‘">$(OPENCV)\x64\vc12\lib;$(LibraryPath)</LibraryPath>  </PropertyGroup>  <ItemDefinitionGroup>        <Link Condition="‘$(Configuration)‘==‘Debug‘">          <AdditionalDependencies>opencv_calib3d2413d.lib;opencv_contrib2413d.lib;opencv_core2413d.lib;opencv_features2d2413d.lib;opencv_flann2413d.lib;opencv_gpu2413d.lib;opencv_highgui2413d.lib;opencv_imgproc2413d.lib;opencv_legacy2413d.lib;opencv_ml2413d.lib;opencv_nonfree2413d.lib;opencv_objdetect2413d.lib;opencv_ocl2413d.lib;opencv_photo2413d.lib;opencv_stitching2413d.lib;opencv_superres2413d.lib;opencv_ts2413d.lib;opencv_video2413d.lib;opencv_videostab2413d.lib;%(AdditionalDependencies)</AdditionalDependencies>        </Link>        <Link Condition="‘$(Configuration)‘==‘Release‘">          <AdditionalDependencies>opencv_calib3d2413.lib;opencv_contrib2413.lib;opencv_core2413.lib;opencv_features2d2413.lib;opencv_flann2413.lib;opencv_gpu2413.lib;opencv_highgui2413.lib;opencv_imgproc2413.lib;opencv_legacy2413.lib;opencv_ml2413.lib;opencv_nonfree2413.lib;opencv_objdetect2413.lib;opencv_ocl2413.lib;opencv_photo2413.lib;opencv_stitching2413.lib;opencv_superres2413.lib;opencv_ts2413.lib;opencv_video2413.lib;opencv_videostab2413.lib;%(AdditionalDependencies)</AdditionalDependencies>        </Link>  </ItemDefinitionGroup>  <ItemGroup /></Project>

vs2015中导入属性文件:在菜单栏中选择 “视图”、 “属性管理器”、“添加现有属性表”  

 https://msdn.microsoft.com/zh-cn/library/669zx6zc.aspx

 

4.vs2015运行opencv会出现 找不到msvcp120d.dll msvcr120d.dll丢失,

下载这两个文件放到exe目录下或者%OPENCV%\x86\vc12\bin下

opencv vs环境配置