流视频在OpenCV

stream video in OpenCV

本文关键字:OpenCV 视频      更新时间:2023-10-16

我在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;
}

您没有关闭for循环的括号