2013-08-22 49 views
0

我工作在Windows 7 32位os上的Emgu cv和System.TypeInitializationException發生錯誤,我試過每個解決方案; 當我運行與Emgu來的例子是好的,但是當我創建我自己的項目時發生錯誤。Emgu System.TypeInitializationException在32位窗口7 OS

這是我的代碼;

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
using Emgu.CV; 
using Emgu.CV.Structure; 
using Emgu.Util; 

namespace WindowsFormsApplication1 
{ 
    public partial class Form1 : Form 
     { 
     private Capture cap; 
     private bool capinpro; 

     public Form1() 
     { 
      InitializeComponent(); 
     } 


    private void processframe(object o, EventArgs e) 
    { 

     Image<Bgr, byte> img = cap.QueryFrame(); 
     imageBox1.Image = img; 
    } 



    private void button1_Click(object sender, EventArgs e) 
    { 
     if(cap!=null) 
     { 

      try 
      { 
     if (capinpro) 
     { 
      Application.Idle += processframe;  
      //i have also tried cap.start(); 
     } 
     else 
     { 
      Application.Idle -= processframe; 
     } 


      } 
      catch (Exception ex) 
      { 
       MessageBox.Show(ex.Message); 
      } 




     } 
     else 
     { 
     cap= new Capure(); 
     } 
    } 


} 

}

+0

錯誤發生在哪裏/何時? – joe

+0

您是否包含所有程序集或僅包含一個? –

+0

我已經包含了所有的參考文獻 – sami

回答

0

Emgu庫需要更多dll文件,所以我粘貼所有dll期從Emgu的bin文件夾到我的EXE文件的路徑和問題得到解決。