2012-12-16 3 views
3

나는 웹캠 비디오를 캡처/표시하는 동안 emgu CV & C# 및 낮은 FPS (약 8fps)를 사용하고 있습니다! 지금까지 내가 시도한 것은 이것입니다 : 필자는 필터를 일부 적용해야만 어떻게하면 코드를보다 효율적으로 만들 수 있습니까? GPU를 사용하여 이러한 프레임을 처리 할 수있는 방법이 있습니까?웹캠 비디오 입력의 프레임 속도를 늘리는 방법은 무엇입니까? Emgu CV

private Capture _capture; 
    private bool _captureInProgress; 
    private Image<Bgr, Byte> frame; 
    private void ProcessFrame(object sender, EventArgs arg) 
    { 
     frame = _capture.QueryFrame(); 
     captureImageBox.Image = frame; 

    } 

    private void startToolStripMenuItem_Click(object sender, EventArgs e) 
    { 
     #region if capture is not created, create it now 
     if (_capture == null) 
     { 
      try 
      { 
       _capture = new Capture(); 
      } 
      catch (NullReferenceException excpt) 
      { 
       MessageBox.Show(excpt.Message); 
      } 
     } 
     #endregion 

     Application.Idle += ProcessFrame; 

     if (_capture != null) 
     { 
      if (_captureInProgress) 
      { 
       //stop the capture 

       startToolStripMenuItem.Text = "Start"; 
       Application.Idle -= ProcessFrame; 
      } 
      else 
      { 
       //start the capture 
       startToolStripMenuItem.Text = "Stop"; 
       Application.Idle += ProcessFrame; 
      } 

      _captureInProgress = !_captureInProgress; 
     } 
    } 
+0

확인하셨습니까? http://www.emgu.com/forum/viewtopic.php?f=7&t=2602? –

+0

예! 그러나 그것은 작동하지 않았다! :/ – SparkWerk

+0

@ Umair는 여전히 문제가됩니까? 당신이 게시 한 코드는 아무런 처리도하지 않고 웹캠에서 프레임을 얻는 것 외에는 아무것도하지 않는 것 같습니다. 더 많은 코드와 웹캠 유형을 게시 할 수 있습니까? – codingadventures

답변

1

문제는 너무 자주 호출되는 Application.Idle 콜백에서 프레임을 처리하고 있다는 것입니다.

_capture.ImageGrabbed += ProcessFrame

와 함께이 라인

Application.Idle += ProcessFrame

를 교체하고 그것을 작동합니다. 이 콜백은 프레임이 사용 가능할 때마다 호출됩니다.

+1

은 _capture.ImageGrabbed + = ProcessFrame이 아니어야합니다. – gonzobrains

+0

이것은 나를 위해 작동하지 않았다. ProcessFrame은 호출되지 않았고 프로그램은 그냥 거기 앉아있었습니다. –

관련 문제