架构师_程序员_码农网

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 10354|回复: 0

[资料] "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?

[复制链接]
发表于 2015-11-25 10:57:59 | 显示全部楼层 |阅读模式
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



类型初始化的emgu。CV。cvinvoke '把例外。
如果你看到这个例外,请检查以下
你有没有安装msvcrt?
版本2 +,捆绑的opencv 2二进制是建立Visual Studio 2008,你将需要installedmsvcrt 9 SP1解决dependencyissue。
1.5版本,捆绑的OpenCV pre1.1二进制建立Visual Studio 2005,你将需要installedmsvcrt 8 SP1解决dependencyissue。
你复制的opencv DLL执行目录?
确保非托管DLL在执行目录。
对于emgu CV版< = 2.1,这意味着以下的DLL:cvxxx.dll,cvauxxxx.dll,cxcorexxx。DLL,highguixxx.dll,opencv_ffmpegxxx.dll,mlxxx.dll andcvextern.dll wherexxx是opencv的versionnumber。
对于emgu CV版> = 2.2这意味着以下的DLL: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 XXX是opencvversion数。
建立你的项目的最好方法是:
非托管DLL复制到你的项目文件夹
右键单击项目,单击“添加-> existingitem选择所有的非托管DLL。将它们添加到项目中。
每个所包含的DLL,左键点击它,找到“复制与输出目录”选项,选择“复制如果更新”
你运行32位操作系统吗?
视窗安装程序只可提供32位视窗。如果你使用的是64位的操作系统,有三种可能的方式解决这一问题:
你可以下载64位二进制只有zip包fromsourceforge并添加到您的项目。
你也可以从64位平台编译OpenCV源。看到建筑fromsvn指令
或者你可以强迫你的。NET应用程序运行in32bit模式,即使在64位操作系统。要做到这一点,在你执行项目的configurationpage,选择平台的目标as'x86”。
你缺少任何依赖吗?
下载依赖沃克和用它来打开“cvextern DLL文件。”。检查是否丢失了任何依赖关系。
我检查了所有以上但我仍然有例外
在这种情况下,请尝试构建和运行实例。在构建实例之后,尝试运行“你好世界”程序。
如果“世界你好”运行没有任何问题,它与youproject比较,发现在结构上的差异和解决它。
如果“你好世界”得到同样的“类型初始值设定项for'emgu。CV。cvinvoke“抛出一个异常。”消息,试图找到outtheinnerexception向论坛





上一篇:0元璐小米手环等产品详细教程
下一篇:C#通过DllImport导入并调用Win32 API 函数
码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

免责声明:
码农网所发布的一切软件、编程资料或者文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:help@itsvse.com

QQ|手机版|小黑屋|架构师 ( 鲁ICP备14021824号-2 )|网站地图

GMT+8, 2024-4-25 20:35

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表