我正在使用 emgu CV 和 C# 并在捕获/显示网络摄像头视频时获得低 FPS(约 8fps)!到目前为止,这是我尝试过的:我还必须应用一些过滤器,我怎样才能让我的代码更有效率?有没有办法使用 GPU 处理这些帧?
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;
}
}