繁体   English   中英

如何在Ubuntu 18.04上运行OpenCvSharp?

[英]How to run OpenCvSharp on Ubuntu 18.04?

我在Ubuntu Linux上运行OpenCvShare时遇到问题。 一直说找不到libOpenCvSharpExtern。

我在Ubuntu 18.04.1 x64上运行OpenCvSharp时遇到问题。 我创建了一个.NET Core / Standard解决方案(Standard是一个库项目,Core是运行器)。 该库项目引用了Nuget软件包:OpenCvSharp4(4.0.0.20181225)OpenCvSharp4.runtime.ubuntu.18.04-x64(4.0.0.20181225)。

然后,在成功编译之后,我使用以下命令发布了Runner项目:

dotnet publish -c Release -r ubuntu.18.04-x64

当我在Ubuntu上运行可执行文件时,将引发以下错误:

Unhandled Exception: OpenCvSharp.OpenCvSharpException: Failed to create VideoCapture System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. OpenCvSharp.OpenCvSharpException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory ---> System.DllNotFoundException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory

文件libOpenCvSharpExtern.so与可执行文件位于同一路径,我也将其复制到usr / local / lib中,而id则无济于事。 应用是基于照相机的进给来检测面部。

好的,我终于开始运行了。 问题出在包含路径中。 当您从lib所在路径中的终端执行ldd libOpenCvSharpExtern.so ,它将输出此库使用的所有引用库。 最初,我有“未找到”参考的完整列表。 所有缺少的库都已安装在/usr/local/lib 原来,该路径不是系统正在寻找库的默认路径。 链接到Ubuntu论坛上的问题

在添加export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib"环境变量并重新启动系统后,一切开始正常工作,并且在libOpenCvSharpExtern.so库上使用ldd清楚地表明,已找到所有库。

暂无
暂无

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

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