OpenCVSharp:无法加载DLL'OpenCvSharpExtern' [英] OpenCVSharp: Unable to load DLL 'OpenCvSharpExtern'

查看:3583
本文介绍了OpenCVSharp:无法加载DLL'OpenCvSharpExtern'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我已经使用NuGet管理器安装了最新的OpenCVSharp 2(2.4.10.201 ...).有关OpenCVSharp.CvMat的所有信息都可以正常运行(加载,操作等),因此我确定安装正确.

I have installed the latest OpenCVSharp 2 (2.4.10.201...) with the NuGet manager in my project. Everything concerning OpenCVSharp.CvMat is working OK (loading, manipulation etc) so I am sure the installation is correct.

但是我根本无法使用OpenCVSharp.CPlusPlus! 问题是它不会加载OpenCvSharpExtern.dll.

However I cannot use OpenCVSharp.CPlusPlus at all! The problem is that it doesn't load OpenCvSharpExtern.dll.

尝试捕获块显示错误:

try
{
    Mat mat = new Mat();
} catch (Exception err)
{
    Console.WriteLine( err );
}

System.TypeInitializationException: The type initializer for 'OpenCvSharp.CPlusPlus.Mat' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at OpenCvSharp.CPlusPlus.NativeMethods.core_Mat_sizeof()
   at OpenCvSharp.CPlusPlus.Mat..cctor()
   --- End of inner exception stack trace ---
   at OpenCvSharp.CPlusPlus.Mat..ctor()
   at MainClass.Main() in C:\Users\kotsias\Documents\Visual Studio 2015\Projects\MyCVSharp\ConsoleApplication1\Test.cs:line 14

OpenCvSharpExtern.dll IS 在以下子文件夹中与我的.exe一起部署:

The OpenCvSharpExtern.dll IS deployed alongside my .exe inside the following subfolders:

.. \ dll \ x86

&

.. \ dll \ x64

如果在与.exe相同的文件夹中手动复制 x64 .dll ,我仍然会遇到上述相同的错误.如果我复制 x86 .dll ,则会收到另一个错误:

If I manually copy the x64 .dll in the same folder as my .exe, I still get the same error above. If I copy the x86 .dll, I get a different error:

System.TypeInitializationException: The type initializer for 'OpenCvSharp.CPlusPlus.Mat' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at OpenCvSharp.CPlusPlus.NativeMethods.core_Mat_sizeof()
   at OpenCvSharp.CPlusPlus.Mat..cctor()
   --- End of inner exception stack trace ---
   at OpenCvSharp.CPlusPlus.Mat..ctor()
   at MainClass.Main() in C:\Users\kotsias\Documents\Visual Studio 2015\Projects\MyCVSharp\ConsoleApplication1\Test.cs:line 14

推荐答案

可能您没有安装正确版本的Visual C ++可再发行组件包.

Probably you don't have correct version of Visual C++ Redistributable package installed.

OpenCvSharp 2.4.10使用Visual C ++ 2013可再发行组件包.但是,不推荐使用 OpenCvSharp 2.4.10 ,作者建议使用

OpenCvSharp 2.4.10 uses Visual C++ 2013 Redistributable Package. However, OpenCvSharp 2.4.10 is deprecated and author recommends to use OpenCvSharp 3.2:

#OpenCvSharp 2.4.10用于.NET Framework的OpenCV 2.4.10的跨平台包装.

#OpenCvSharp 2.4.10 Cross platform wrapper of OpenCV 2.4.10 for .NET Framework.

已弃用该项目.最新版本可在 OpenCvSharp 中获得.

This project is deprecated. The latest release is available in OpenCvSharp.

有关更多信息,请检查:

For more information check:

  • Unable to load DLL (Module could not be found HRESULT: 0x8007007E) discussion
  • Why Are There So Many "Microsoft Visual C++ Redistributables" Installed on My PC? article
  • OpenCvSharp 3.2 NuGet page.

这篇关于OpenCVSharp:无法加载DLL'OpenCvSharpExtern'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆