Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found

2021-09-17  乐帮网

摄像头 netcore opencv

使用OpenCvSharp时遇到错误中:Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found.这个明显是缺少OpenCvSharpExtern.dll引起的。如果你是在windows下使用的话。如果部署的是linux环境,则是缺少相关的so文件。这些文件通过是在发布后的runtime文件中。解决办法网上搜索到的以下方法:

(1)项目清理一下再运行或发布。
(2)CPU类型指定了特定类型。例如 64 ,改成Any CUP即可。
(3)重新引入Nuget包,OpenCvSharp。
(4)检查项目类型,例如我们使用.NET Standard 2.1类库依赖来生成.Net Core 3.1 项目,相反就有问题。

然而并不管用

我的解决方案全在这里:https://lebang2020.cn/details/210920eeneozlv.html

 

ikanopu_1  | Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found.
ikanopu_1  |  (Exception from HRESULT: 0x8007007E)
ikanopu_1  | *** An exception has occurred because of P/Invoke. ***
ikanopu_1  | Please check the following:
ikanopu_1  | (1) OpenCV's DLL files exist in the same directory as the executable file.
ikanopu_1  | (2) Visual C++ Redistributable Package has been installed.
ikanopu_1  | (3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.
ikanopu_1  |
ikanopu_1  | System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found.
ikanopu_1  |  (Exception from HRESULT: 0x8007007E)
ikanopu_1  |    at OpenCvSharp.NativeMethods.core_Mat_sizeof()
ikanopu_1  |    at OpenCvSharp.NativeMethods.TryPInvoke()
ikanopu_1  |
ikanopu_1  | Unhandled Exception: System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. ---> OpenCvSharp.OpenCvSharpException: Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found.
ikanopu_1  |  (Exception from HRESULT: 0x8007007E)
ikanopu_1  | *** An exception has occurred because of P/Invoke. ***
ikanopu_1  | Please check the following:
ikanopu_1  | (1) OpenCV's DLL files exist in the same directory as the executable file.
ikanopu_1  | (2) Visual C++ Redistributable Package has been installed.
ikanopu_1  | (3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.
ikanopu_1  |
ikanopu_1  | System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found.
ikanopu_1  |  (Exception from HRESULT: 0x8007007E)
ikanopu_1  |    at OpenCvSharp.NativeMethods.core_Mat_sizeof()
ikanopu_1  |    at OpenCvSharp.NativeMethods.TryPInvoke() ---> System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module or one of its dependencies could not be found.
ikanopu_1  |  (Exception from HRESULT: 0x8007007E)
ikanopu_1  |    at OpenCvSharp.NativeMethods.core_Mat_sizeof()
ikanopu_1  |    at OpenCvSharp.NativeMethods.TryPInvoke()
ikanopu_1  |    --- End of inner exception stack trace ---
ikanopu_1  |    at OpenCvSharp.NativeMethods.TryPInvoke()
ikanopu_1  |    at OpenCvSharp.NativeMethods..cctor()
ikanopu_1  |    --- End of inner exception stack trace ---
ikanopu_1  |    at OpenCvSharp.NativeMethods.core_Mat_new2(Int32 rows, Int32 cols, Int32 type)
ikanopu_1  |    at ikanopu.Service.ImageProcessingService.InitializeAsync(GlobalConfig config) in /src/ikanopu/Service/ImageProcessingService.cs:line 46
ikanopu_1  |    at ikanopu.Program.<Main>d__3.MoveNext() in /src/ikanopu/Program.cs:line 89
ikanopu_1  | --- End of stack trace from previous location where exception was thrown ---
ikanopu_1  |    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
ikanopu_1  |    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
ikanopu_1  |    at ikanopu.Program.<Main>(String[] args)
ikanopu_ikanopu_1 exited with code 139

 

公众号二维码

关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com

庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。

欧阳修

付款二维码

如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力