What Can I do if "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?

转载 2012年03月23日 00:07:21

fromhttp://www.emgu.com/wiki/index.php/Download_And_Installation#Building_the_Examples


The type initializer for 'Emgu.CV.CvInvoke' threw anexception.

If you see this exception, please check the following

Have you installed MSVCRT?

  • For Version 2.0+, the bundled OpenCV 2.0 binary is build withVisual Studio 2008, you will needs to installedMSVCRT 9.0 SP1 to resolve the dependencyissue.
  • For Version 1.5, the bundled OpenCV pre1.1 binary is build withVisual Studio 2005, you will needs to installedMSVCRT 8.0 SP1 to resolve the dependencyissue.

Have you copied the OpenCV dlls to the execution directory?

  • Make sure the unmanaged DLLs are in the execution directory.
    • For Emgu CV version <= 2.1, this means thefollowing dlls: cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll,highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dll andcvextern.dll whereXXX is the OpenCV versionnumber.
    • For Emgu CV version >= 2.2 this means thefollowing dlls: opencv_calib3dXXX.dll, opencv_contribXXX.dll,opencv_coreXXX.dll, opencv_features2dXXX.dll,opencv_highguiXXX.dll, opencv_imgprocXXX.dll, opencv_legacyXXX.dll,opencv_mlXXX.dll, opencv_objectdetectXXX.dll,opencv_videoXXX.dll where XXX is the OpenCVversion number.
  • The best way to set up your project is:
    • Copy the unmanaged DLLs to your project folder
    • Right click on the project, click Add->ExistingItem and select all unmanaged DLLs. Add them to the project.
    • For each of the included Dlls, left click on it, find the "Copyto Output Directory" option and select "Copy if newer"

Are you running a 32-Bit OS?

The windows installer is only available for 32-Bit windows. Ifyou are using a 64-bit OS, there are three possible ways to resolvethis issue:

  • You can download the 64bit binary only zip package fromsourceforge and add it to your project.
  • You can also recompile OpenCV from source for 64-bit platform. See the instruction for building fromSVN
  • Alternatively you can force your .NET application to run in32bit mode, even on a 64-bit OS. To do this, in the configurationpage of your executable project, select Platform Target as'x86'.

Are you missing any dependency?

Download Dependency Walker and use it to open the"cvextern.dll" file. Check if any dependency is missing.

I have checked all of above but I still got theException

In this case, please try to build and run the examples.After building the examples, try to run the "Hello World"Program.

If "Hello World" runs without any problem, compare it with youproject, find the difference in configuration and fix it.

If "Hello World" get the same "The type initializer for'Emgu.CV.CvInvoke' threw an exception." message, try to find outtheInnerException and report it to the discussion forum


C#-opencv-------显示图片异常"Emgu.CV.CvInvoke"的类型初始值设

1."Emgu.CV.CvInvoke"的类型初始值设定项引发异常. 将...\bin\x86目录(C:\Emgu\emgucv-windows-universal-gpu 2.4.9.1847\bi...
  • huang9012
  • huang9012
  • 2014年01月09日 16:03
  • 5979

The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.

当使用EF时,配置文件中会多出下面的配置代码: 然后在访问EF的时候会报下面的错误: The type initializer for 'System.Da...
  • mx5721
  • mx5721
  • 2014年08月30日 18:29
  • 4487

C#中异常:“The type initializer to throw an exception(类型初始值设定项引发异常)”的简单分析与解决方法

对于C#中异常:“The type initializer to throw an exception(类型初始值设定项引发异常)”的简单分析,目前本人分析两种情况,如下:...
  • u012688910
  • u012688910
  • 2015年01月12日 12:53
  • 2003

使用Spire组件抛出异常The type initializer for 'spr857' threw an exception

使用Spire组件抛出异常The type initializer for 'spr857' threw an exception   我使用免费的Spire.Xls组件尝试去转换Exce...
  • Eiceblue
  • Eiceblue
  • 2015年03月23日 16:53
  • 1542

Office组件之Spire.XSL的DotNet操作

http://www.cnblogs.com/gaohongchen01/p/5061211.html Overview   在项目中,我们经常需要将程序中获得的大量数据导出到Excel表...
  • zdy0_2004
  • zdy0_2004
  • 2015年12月20日 17:49
  • 593

The type initializer threw an exception.

DbHelperSQL类 public readonly static string ConnectionString = EncryptDecrypt.DESEncrypt.Decrypt( Co...
  • x3230835
  • x3230835
  • 2015年06月09日 18:19
  • 1388

what can i do?

no playing the box right?no women can show right?no body can join...i relly love this fucking city.....
  • k0011
  • k0011
  • 2009年12月31日 19:41
  • 128

what can i do

越来越觉得自己不知道的东西太多看着别人貌似都很厉害的样子有点心急有点烦 经常会跟自己说慢慢来吧心急吃不了热豆腐很多东西都是累积而来的我唯一能做的也许只是努力努力再努力加油加油再加油 对于自己以后会走向...
  • somnus_lp
  • somnus_lp
  • 2010年02月22日 17:05
  • 134

What do I desire

1. I want to build a house, my oun house, with a farm behind. 2. I want to have a car 3. I want le...
  • irencewh
  • irencewh
  • 2015年10月29日 13:50
  • 718

NUnit Error: The Type Initializer for … Threw an Exception (And app.config)

My Visual Studio solution contains 5 projects, one of them is for unit testing purpose.The unit test...
  • shulin85
  • shulin85
  • 2011年05月27日 12:16
  • 3082
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:What Can I do if "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?
举报原因:
原因补充:

(最多只允许输入30个字)