错误:“Emgu.CV.CvInvoke”的类型初始化程序引发异常

我的项目中有这段代码:

MCvFont font = new MCvFont(FONT.CV_FONT_HERSHEY_SCRIPT_SIMPLEX, 0.2d, 0.2d); 

当程序运行时,它给出了一个异常:

'Emgu.CV.CvInvoke' 的类型初始化程序引发异常。

所以请帮我解决这个问题。

stack overflow Error:The type initializer for 'Emgu.CV.CvInvoke' threw an exception
原文答案

答案:

作者头像

Usually these kind of "Emgu.CV.CvInvoke" exception will throw if there are some problems with your Emgucv Dll's.

Check these following thing's:

  1. Open Your Project & Verify whether all the Project-> Reference's are made correctly.e.g Emgu.CV.UI.dll,Emgu.CV.dll,Emgu.CV.dll etc..
  2. Check the Copy to Local Check box is ticked or not.
  3. If your OS is 32-Bit then make sure you are linking only 32-Bit Dll's. If you are working with 64-Bit OS then copy relevant 64-Bit Dll's.
  4. Copy the opencv_xxx.dll's from your opencv directory to your Bin Dir.
  5. Finally Check all the dll's are present in the Bin directory or not.

Now compile & run the program.

相关问题