简体   繁体   English

具有Visual Studio 2015 Enterprise的OpenCV

[英]OpenCV with Visual Studio 2015 Enterprise

Hello Im trying to use OpenCV 3.0 with Visual Studio 2015 Enterprise but for some reason it is not working, what am I doing wrong ? 您好,我想在Visual Studio 2015 Enterprise中使用OpenCV 3.0 ,但由于某种原因它无法正常工作,我在做什么错?

First of all I have OpenCV extracted in C:\\opencv\\ with 7z archive 首先,我用7z存档在C:\\ opencv \\中提取了OpenCV

  1. In Visual Studio Project -> TestProject Properties 在Visual Studio项目-> TestProject属性中

Configuration -> All Configuration && Platform -> All Platform 配置->所有配置&&平台->所有平台

  1. Configuration Properties -> VC++ Directory -> Include Directories => C:\\opencv\\opencv\\build\\include 配置属性-> VC ++目录->包含目录=> C:\\ opencv \\ opencv \\ build \\ include
  2. Configuration Properties -> VC++ Directory -> Library Directories => C:\\opencv\\opencv\\build\\x86\\vc12\\lib 配置属性-> VC ++目录->库目录=> C:\\ opencv \\ opencv \\ build \\ x86 \\ vc12 \\ lib
  3. Configuration Properties -> C/C++ -> General -> Additional Include Libraries => C:\\opencv\\opencv\\build\\include 配置属性-> C / C ++->常规->其他包含库=> C:\\ opencv \\ opencv \\ build \\ include
  4. Configuration Properties -> Linker -> General -> Additional Library Directories => C:\\opencv\\opencv\\build\\x86\\vc12\\bin 配置属性->链接器->常规->其他库目录=> C:\\ opencv \\ opencv \\ build \\ x86 \\ vc12 \\ bin

Configuration -> Debug && Platform -> All Platform 配置->调试&&平台->所有平台

  1. Configuration Properties -> Linker -> Input -> Additional Dependencies => 配置属性->链接器->输入->其他依赖关系=>

opencv_ts300d.lib opencv_ts300d.lib

opencv_world300d.lib opencv_world300d.lib

Configuration -> Release && Platform -> All Platform 配置->版本和&平台->所有平台

  1. Configuration Properties -> Linker -> Input -> Additional Dependencies => 配置属性->链接器->输入->其他依赖关系=>

opencv_ts300.lib opencv_ts300.lib

opencv_world300.lib opencv_world300.lib


Now when I run a sample code I get MSVCP120D.dll is missing and MSVCR120D.dll is missing and cannot open input file 'kernel32.lib' errors. 现在,当我运行示例代码时,我丢失了MSVCP120D.dll,丢失了MSVCR120D.dll,无法打开输入文件'kernel32.lib'错误。 Does anyone had the same problem or know a solution ? 是否有人遇到相同的问题或知道解决方案?

MSVCP120D.dll One option is install redistributable Packages for older Visual Studio. MSVCP120D.dll一种选择是为较旧的Visual Studio安装可再发行软件包。 And include this libs directly in your app from ProgramFiles/MicrosoftSDK/Windows/version/libs. 并直接从ProgramFiles / MicrosoftSDK / Windows / version / libs将这些库包含在您的应用程序中。 This path find simply during the instalation. 该路径仅在安装期间找到。 This is for Visual studio 2013 here Package Here 这是针对Visual Studio 2013的封装

Better is recompile opencv with cmake and visual studio. 更好的方法是使用cmake和Visual Studio重新编译opencv。

Build opencv with Visual Studio 2015 compiler from source first. 首先从源代码使用Visual Studio 2015编译器构建opencv。 This reduce a risk that older framework missing in your computer. 这样可以减少计算机中缺少旧框架的风险。 You need vc14 directory as a source of your libs. 您需要vc14目录作为您的库的源。 Prebuild libs are only for VS 2012 and 2013, which is VC11 and VC12 libs folder under your opencv/build/x64 or x86. Prebuild库仅适用于VS 2012和2013,即opencv / build / x64或x86下的VC11和VC12库文件夹。 Speps are simple. 飞溅很简单。

  1. Download CMAKE, install 下载CMAKE,安装
  2. Download source code of Opencv, extract 下载Opencv的源代码,解压缩
  3. run Cmake and add directory of your source and target directory for your project. 运行Cmake并为您的项目添加源目录和目标目录。
  4. Configure Cmake just choose right compiler VS2015 first. 配置Cmake只需先选择正确的编译器VS2015。 There is many options. 有很多选择。 Just try the default one first. 只需先尝试默认值即可。
  5. Run Cmake. 运行Cmake。 Result is Visual Studio 2015 project like opencv.sln under target directory. 结果是Visual Studio 2015项目,如目标目录下的opencv.sln。
  6. Open opencv.sln project 打开opencv.sln项目
  7. Build this project with Visual Studio 2015. Result is VC14 directory with libs to include. 使用Visual Studio 2015构建此项目。结果是带有要包含的库的VC14目录。

Check this picture by picture tutorial. 通过图片教程检查该图片。 Tutorial Here 教程在这里

Also you can use NUGET console Tutorial Nuget opencv 您也可以使用NUGET控制台教程Nuget opencv

要修复“缺少MSVCP120D.dll和MSVCR120D.dll”,请下载它们并将其放在此处C:\\ Windows \\ System32

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM