Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Opencv RTSP流的污损/损坏捕获_Opencv_Rtsp_Emgucv_Capture_Corruption - Fatal编程技术网

Opencv RTSP流的污损/损坏捕获

Opencv RTSP流的污损/损坏捕获,opencv,rtsp,emgucv,capture,corruption,Opencv,Rtsp,Emgucv,Capture,Corruption,我已经使用emgu cv 2.4.10创建了一个RTSP流查看器,它最终将与IP摄像头一起使用。由于我还没有摄像头,我正在测试使用VLC(windows GUI)从视频文件创建流 :sout=#duplicate{dst=rtp{sdp=rtsp://:8554/stream},dst=display} :sout-all :sout-keep 我在本地主机上做这些测试 以下是我的捕获代码: private void ProcessFrame(object sender, EventArgs

我已经使用emgu cv 2.4.10创建了一个RTSP流查看器,它最终将与IP摄像头一起使用。由于我还没有摄像头,我正在测试使用VLC(windows GUI)从视频文件创建流

:sout=#duplicate{dst=rtp{sdp=rtsp://:8554/stream},dst=display} :sout-all :sout-keep
我在本地主机上做这些测试

以下是我的捕获代码:

private void ProcessFrame(object sender, EventArgs arg) {
    try {
        frame = _capture.QueryFrame();
        pictureBox1.Image = frame.ToBitmap();
    }
    catch (Exception ex) {
        MessageBox.Show(ex.Message.ToString());
    }
}
使用以下eventhandler调用此方法:

_capture = new Capture("rtsp://localhost:8554/stream");
Application.Idle += ProcessFrame;
_capture.Start();
捕获被随机出现的“涂抹”损坏,这些“涂抹”总是发生在帧的下部:

我在网上看到一些其他人在去年12月就报告了这个问题,但没有找到解决方案,也没有找到适合我的解决方案:

为了缩小问题的范围,我从命令行运行了ffplay,捕获过程非常完美。我运行了另一个VLC实例来捕获RTSP流,它显示得非常完美。因此,这显然是open cv/emgu cv中的一个问题

一时兴起,我使用HTTP将VLC改为流

:sout=#duplicate{dst=http{mux=ffmpeg{mux=flv},dst=:8080/stream},dst=display} :sout-all :sout-keep

这在我的代码中显示得很好,但帧速率明显较低,这对我的应用程序不起作用。我真的很感激任何解决这个问题的建议。谢谢。

我不知道您是否解决了问题,但我建议您不要在application.idle事件中进行处理。相反,使用线程。创建另一个线程并在其中进行处理。示例c#代码:


谢谢你的回复。我最终更新到了最近发布的Emgu.CV-3.0.0-rc1。令我惊讶的是,这似乎解决了我所有的涂抹问题。到现在为止,一直都还不错。
Thread t = new Thread(new ThreadStart(()=>{ while(true) {frame = _capture.QueryFrame();
        pictureBox1.Image = frame.ToBitmap();}}));  t.IsBackGround = true; t.Start();