Error:The type initializer for 'Emgu.CV.CvInvo

2019-09-02 11:07发布

问题:

I have this code in my project:

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

When program runs, It gives an exception:

The type initializer for 'Emgu.CV.CvInvoke' threw an exception.

So please help me with on this issue.

回答1:

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.



标签: c# emgucv