代码之家  ›  专栏  ›  技术社区  ›  Amin Ullah

EmguCv实时视频解码中的600毫秒延迟

  •  0
  • Amin Ullah  · 技术社区  · 6 年前

    我正在使用C#开发一个实时计算机视觉应用程序。但我无法优化Emgucv解码。从地面实况到600毫秒延迟,从Ip摄像头提供商应用程序轴到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();
    }
    

    我的应用程序与camera provider应用程序的秒表结果比较: Stopwatch results of my application comparing with camera provider application

    1 回复  |  直到 6 年前
        1
  •  0
  •   Amin Ullah    6 年前

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

    来源 Real-time RTSP Stream Decoding