在.net6 使用opencvsharp4 在ubuntu arm64环境下遇到的问题

rk 3399Pro 嵌入式板子

.net6 中使用opencvsharp 开发时,windows平台可以正常运行,ubuntu 20.6,arm64架构下运行报错:unhandled exception. system.typeinitializationexception: the type initializer for 'opencvsharp.internal.nativemethods' threw an exception.%0d%0a ---> 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.

 

 

 

解决方法:

因为nuget没有提供arm64opencvsharp4,所以需要去github下载源码到ubuntu上进行编译,参考文档地址:https://github.com/shimat/opencvsharp/issues/667,

:图中的版本以及编译命令按照实际需要去修改

 

 

 

将编译好的文件(build/OpenCvSharpExtern文件夹下的libOpenCvSharpExtern.so)拷贝到/usr/local/lib目录下。

:根据实际情况去选择目标目录,本文只提供参考

 

验证: ldd /usr/local/lib/libOpenCvSharpExtern.so

查看是否有not found的指向,逐个处理。

posted @ 2023-05-18 11:32  DemoF  阅读(1367)  评论(6)    收藏  举报