Emgu.CV.CvInvoke'抛出了c#, Opencv和EmguCv的异常

本文关键字:Opencv EmguCv 异常 CvInvoke CV Emgu | 更新日期: 2023-09-27 18:12:21

我已经使用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,但仍然出错。

我使用windows 7 pro x86, VS 2010, EmguCV2.4.2和遵循这个教程:http://www.youtube.com/watch?v=vdjoutNR2DQ

帮帮我!

Emgu.CV.CvInvoke'抛出了c#, Opencv和EmguCv的异常

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