在OpenCV中流式传输视频

时间:2014-03-16 18:06:27

标签: c++ opencv

我在beaglebone上运行一个简单的OpenCV程序,出于调试目的,我希望看到一个输出流。我试图在命令行中执行此操作

./myprog | avconv -f rawvideo -pix_fmt bgr24 -s 160x90 -r 30 -i - -an -f mpegts udp://192.168.7.1:1234

我正在使用VLC在我的笔记本电脑上播放udp流,但这似乎不起作用,我想知道我可以通过其他方式实现这一点,任何帮助都会有所帮助。

我的程序很简单,

int main()
{
    VideoCapture capture(0);
   if(!capture.isOpened()){
        cout << "Failed to connect to the camera." << endl;
    }
    for(;;)
    {
    Mat frame;
    capture >> frame;
        if(frame.empty()){
        cout << "Failed to capture an image" << endl;
        return -1;
        }
    cout << frame.data;
    return 0;
}

1 个答案:

答案 0 :(得分:1)

您没有关闭for循环的括号。