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

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值