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...

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

使用Spire组件抛出异常The type initializer for 'spr857' threw an exception   我使用免费的Spire.Xls组件尝试去转换Exce...

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

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

009:How can I test if an array contains a certain value?

题目:判断一个元素是否在数组中?1.存储到List中,让List 去遍历 2.存储到Set中,让set去遍历 3.自己顺序遍历 4.二分查找import java.util.*;public c...

What can I learn right now in just 10 minutes that could be useful for the rest of my life?

What can I learn right now in just 10 minutes that could be useful for the rest of my life?

iOS报错terminate_handler unexpectedly threw an exception

今天遇到了一个非常奇葩的坑,但是我又不得不承认这也算是一个bug。 由于感觉这可能是万分之一的踩坑概率,所以我想把这个记录下来, 万一有和我一样莫名其妙被坑的人呢,嘿嘿...... ...
  • meyin
  • meyin
  • 2017年07月13日 10:54
  • 223

libc++abi.dylib: terminate_handler unexpectedly threw an exception//NSScanner: nil string argument

2015-04-03 18:16:10.077 YFFamilyMall[9283:256070] NSScanner: nil string argument 2015-04-03 18:16:10...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:What Can I do if "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?
举报原因:
原因补充:

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