如何在Raspberry PI 2上运行EMGU CV示例应用程序

时间:2016-04-06 08:59:04

标签: c#-4.0 mono raspberry-pi2

我下载了用于Raspberry Pi 2的Emgucv,当我尝试使用此cmd运行应用程序时,有一些示例项目

 mono /home/pi/Downloads/libEmgu/usr/bin/Example.HelloWorld.monoexe

我得到了例外

 Unhandled Exception:
 System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.CV.CvInvoke ---> System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.Util.Platform --->      System.DllNotFoundException: c
 at (wrapper managed-to-native) Emgu.Util.Platform:uname (intptr)
 at Emgu.Util.Platform..cctor () [0x00000] in <filename unknown>:0 
 --- End of inner exception stack trace ---
 at Emgu.CV.CvInvoke.GetModuleFormatString () [0x00000] in <filename  unknown>:0 
 at Emgu.CV.CvInvoke..cctor () [0x00000] in <filename unknown>:0 
 --- End of inner exception stack trace ---
 at HelloWorld.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.CV.CvInvoke ---> System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.Util.Platform ---> System.DllNotFoundException: c
at (wrapper managed-to-native) Emgu.Util.Platform:uname (intptr)
at Emgu.Util.Platform..cctor () [0x00000] in <filename unknown>:0 
--- End of inner exception stack trace ---
at Emgu.CV.CvInvoke.GetModuleFormatString () [0x00000] in <filename unknown>:0 
at Emgu.CV.CvInvoke..cctor () [0x00000] in <filename unknown>:0 
--- End of inner exception stack trace ---
at HelloWorld.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

任何人都可以帮助指导如何使用opencv运行应用程序。

1 个答案:

答案 0 :(得分:0)

System.DllNotFoundException:

未找到Emgu CV本机库:

  

System.TypeInitializationException:抛出异常   emgu.CV.CvInvoke的类型初始值设定项---&gt;   System.TypeInitializationException:抛出异常   emgu.Util.Platform的类型初始值设定项---&gt;
  System.DllNotFoundException:

安装完&amp;编译Emgv CV(不仅仅是C#包装器代码,还包括CPP代码),在Linux上你需要告诉Mono运行时它可以找到本机库(即使它们与C#位于同一目录中)组件):

运行示例

cd bin

在你的情况下:

cd /home/pi/Downloads/libEmgu/usr/bin/

分配动态库路径:

export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

在bin目录中运行示例:

mono Example.HelloWorld.monoexe

请参阅以下链接以获取更多详细信息:http://www.emgu.com/wiki/index.php/Download_And_Installation#Build_the_binary