在.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没有提供arm64的opencvsharp4包,所以需要去github下载源码到ubuntu上进行编译,参考文档地址:https://github.com/shimat/opencvsharp/issues/667,
注:图中的版本以及编译命令按照实际需要去修改

将编译好的文件(build/OpenCvSharpExtern文件夹下的libOpenCvSharpExtern.so)拷贝到/usr/local/lib目录下。
注:根据实际情况去选择目标目录,本文只提供参考
验证: ldd /usr/local/lib/libOpenCvSharpExtern.so
查看是否有not found的指向,逐个处理。

浙公网安备 33010602011771号