【问题标题】:600 Milliseconds delay in EmguCv real-time video DecodingEmguCv 实时视频解码延迟 600 毫秒
【发布时间】:2018-07-27 00:00:21
【问题描述】:

我正在使用 C# 开发一个实时计算机视觉应用程序。但我无法优化 Emgucv 解码。我与地面实况有 800 毫秒的延迟,而 Ip 相机提供商应用程序 AXIS 有 600 毫秒的延迟。

如何优化最多可以延迟 250 毫秒的代码?

这是抓取图像的代码。

capture1 = new Capture(IpFirstCamTxt.Text);     //create a camera captue from RTSP Stream
capture2 = new Capture(Ip2ndCamTxt.Text);
capture3 = new Capture(Ip3rdCamTxt.Text);
capture4 = new Capture(Ip4thCamTxt.Text);

capture1.Start();
capture2.Start();
capture3.Start();
capture4.Start();
capture1.ImageGrabbed += ProcessFrame1;
capture2.ImageGrabbed += ProcessFrame2;
capture3.ImageGrabbed += ProcessFrame3;
capture4.ImageGrabbed += ProcessFrame4;



private void ProcessFrame1(object sender, EventArgs arg)
{
    _capture.RetrieveBgrFrame().ToBitmap());
    capture1.Retrieve(img1, 3);
    pictureBox1.Image = img1.ToBitmap();
}
private void ProcessFrame2(object sender, EventArgs arg)
{
    capture2.Retrieve(img2, 3);
    pictureBox3.Image = img2.ToBitmap();

}
private void ProcessFrame3(object sender, EventArgs arg)
{
    capture3.Retrieve(img3, 3);
    pictureBox4.Image = img3.ToBitmap();
}
private void ProcessFrame4(object sender, EventArgs arg)
{
    capture4.Retrieve(img4, 3);
    pictureBox5.Image = img4.ToBitmap();
}

我的应用程序与相机提供商应用程序的秒表结果比较:

【问题讨论】:

  • 您可以尝试不同的线程来检索图像,这样可以减少抓帧的延迟
  • Imagegraber 已经在单独的线程中运行
  • 您是否为每个相机尝试了单独的线程?
  • 我没有为每个相机制作单独的线程但是我已经为主线程的解码制作了单独的线程

标签: c# opencv real-time picturebox emgucv


【解决方案1】:

上述问题已使用名为 LIVE555 的实时 RTSP 流捕获库之一解决。我在 C++ 中使用过它,并与 C# 共享图像的内存。 延迟减少到大约 200 毫秒左右。 如果有人想要实时视频流,那么 LIVE555 是最好的。 我会将项目上传到我的 Github。

来源Real-time RTSP Stream Decoding

【讨论】:

  • 您的链接指向一个空的存储库。请直接在答案中插入代码(总是)。
  • 亲爱的,该链接现在可用,因为它不是小代码,它是完整的包,这就是我上传到那里的原因。
  • 感谢您提供此链接,它可能会提供一些有限的即时帮助。一个答案should include sufficient context around the link,这样您的其他用户就会知道它是什么以及它为什么存在。始终引用重要链接中最相关的部分,以使其对有其他类似问题的未来读者更有用。请edit您的回答添加一些解释,包括您所做的假设。
猜你喜欢
  • 2016-09-24
  • 1970-01-01
  • 2019-10-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-03
相关资源
最近更新 更多