错误'Emgu.CV.CvInvoke'的类型初始值设定项引发了C#,Opencv和EmguCv的异常

时间:2013-05-07 09:48:55

标签: c#

我已经使用EmguCV在C#中编写了简单的程序来检测VS 2010,但是我得到以下异常:

The type initializer for 'Emgu.CV.CvInvoke' threw an exception.

我正在尝试修复此关注链接:http://www.emgu.com/wiki/index.php/Download_And_Installation#The_type_initializer_for_.27Emgu.CV.CvInvoke.27_threw_an_exception

我复制了所有的dll,但仍然是错误。

我使用window 7 pro x86,VS 2010,EmguCV2.4.2并遵循本教程:http://www.youtube.com/watch?v=vdjoutNR2DQ

帮帮我!

1 个答案:

答案 0 :(得分:0)

@Marc Gravell:这是我的问题

    See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'opencv_core242': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Emgu.CV.CvInvoke.cvRedirectError(CvErrorCallback errorHandler, IntPtr userdata, IntPtr prevUserdata)
at Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
at Emgu.CV.CvInvoke.cvCreateCameraCapture(Int32 index)
at Emgu.CV.Capture..ctor(Int32 camIndex)
at Emgu.CV.Capture..ctor()
at WindowsFormsApplication2.Form1.Form1_Load(Object sender, EventArgs e) in D:\khtn\new\do an\project\WindowsFormsApplication2\WindowsFormsApplication2\Form1.cs:line 45
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///G:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
WindowsFormsApplication2
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/khtn/new/do%20an/project/WindowsFormsApplication2/WindowsFormsApplication2/bin/Debug/WindowsFormsApplication2.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///G:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///G:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///G:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Emgu.CV
Assembly Version: 2.4.2.1777
Win32 Version: 2.4.2.1777
CodeBase: file:///D:/khtn/new/do%20an/project/WindowsFormsApplication2/WindowsFormsApplication2/bin/Debug/Emgu.CV.DLL
----------------------------------------
Emgu.Util
Assembly Version: 2.4.2.1777
Win32 Version: 2.4.2.1777
CodeBase: file:///D:/khtn/new/do%20an/project/WindowsFormsApplication2/WindowsFormsApplication2/bin/Debug/Emgu.Util.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///G:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///G:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Emgu.CV.UI
Assembly Version: 2.4.2.1777
Win32 Version: 2.4.2.1777
CodeBase: file:///D:/khtn/new/do%20an/project/WindowsFormsApplication2/WindowsFormsApplication2/bin/Debug/Emgu.CV.UI.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

    <configuration>
    <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.