我正在尝试使用mono在Raspberry Pi 3上运行C#程序。该程序可以正确启动,但是一旦到达使用某些OpenCV库的位置,程序错误就会显示以下输出:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: opencv_core220
at (wrapper managed-to-native) Emgu.CV.CvInvoke:cvRedirectError (Emgu.CV.CvInvoke/CvErrorCallback,intptr,intptr)
at Emgu.CV.CvInvoke..cctor () [0x00023] in <4f43ef68be294203a100f85f9cebb2b6>:0
--- End of inner exception stack trace ---
at Emgu.CV.Image`2[TColor,TDepth].AllocateData (System.Int32 rows, System.Int32 cols, System.Int32 numberOfChannels) [0x0002e] in <4f43ef68be294203a100f85f9cebb2b6>:0
at Emgu.CV.Image`2[TColor,TDepth].set_Bitmap (System.Drawing.Bitmap value) [0x00050] in <4f43ef68be294203a100f85f9cebb2b6>:0
at Emgu.CV.Image`2[TColor,TDepth]..ctor (System.Drawing.Bitmap bmp) [0x00008] in <4f43ef68be294203a100f85f9cebb2b6>:0
at App.Program.Main (System.String[] args) [0x00122] in <b44d2f4f9f83495091806ba3e6a1570f>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: opencv_core220
at (wrapper managed-to-native) Emgu.CV.CvInvoke:cvRedirectError (Emgu.CV.CvInvoke/CvErrorCallback,intptr,intptr)
at Emgu.CV.CvInvoke..cctor () [0x00023] in <4f43ef68be294203a100f85f9cebb2b6>:0
--- End of inner exception stack trace ---
at Emgu.CV.Image`2[TColor,TDepth].AllocateData (System.Int32 rows, System.Int32 cols, System.Int32 numberOfChannels) [0x0002e] in <4f43ef68be294203a100f85f9cebb2b6>:0
at Emgu.CV.Image`2[TColor,TDepth].set_Bitmap (System.Drawing.Bitmap value) [0x00050] in <4f43ef68be294203a100f85f9cebb2b6>:0
at Emgu.CV.Image`2[TColor,TDepth]..ctor (System.Drawing.Bitmap bmp) [0x00008] in <4f43ef68be294203a100f85f9cebb2b6>:0
at App.Program.Main (System.String[] args) [0x00122] in <b44d2f4f9f83495091806ba3e6a1570f>:0
提到的库“ opencv_core220”是一个与我使用mono执行的exe位于同一目录的dll。 我该怎么做才能解决此问题? 到目前为止,我从未使用过mono,但是我读到您不能在linux上使用dll,就像在Windows上一样,但是您必须使用so-files。但是我不知道如何从dll中获取它们。 该程序完全可以在Windows上运行。
答案 0 :(得分:0)
有些带有.net字节码的dll和使用Windows本机代码的dll。您需要使用Linux本机代码的等效文件!
答案 1 :(得分:-1)
将.dll文件转换为.so文件,然后将.so文件添加到/ usr / lib。然后运行您的exe并检查