2011-10-02 43 views

回答

0

好的。有一個不同的構造函數。我正在構建Emgu CV的7線演示。

使用正確的重載的構造函數,這是沒有的伎倆對我來說:

private Capture _capture; 

    private void InitCapture(Int32 _camIndex) {   
     try { 
      if (_capture != null) { 
       Application.Idle -= ProcessFrame;    
      } 

      _capture = new Capture(_camIndex); 
      Application.Idle += ProcessFrame; 
     } 
     catch (NullReferenceException excpt) { 
      XtraMessageBox.Show(excpt.Message); 
     } 
    } 

    private void ProcessFrame(object sender, EventArgs arg) { 
     Image<Bgr, Byte> frame = _capture.QueryFrame(); 
     ImageBoxCapture.Image = frame; 
    } 

    private void CharmsBarBase_ButtonTop01Click(object sender, EventArgs e) { 
     InitCapture(0); 
    } 

    private void CharmsBarBase_ButtonTop02Click(object sender, EventArgs e) { 
     InitCapture(1); 
    } 

問候。