问题
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:
- 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..
- Check the Copy to Local Check box is ticked or not.
- 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.
- Copy the opencv_xxx.dll's from your opencv directory to your Bin Dir.
- Finally Check all the dll's are present in the Bin directory or not.
Now compile & run the program.
来源:https://stackoverflow.com/questions/24299467/errorthe-type-initializer-for-emgu-cv-cvinvoke-threw-an-exception