~$ 存档

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

int main(int, char**) {
    cv::VideoCapture vcap;
    cv::Mat image;
    
    const std::string videoStreamAddress = "rtsp://admin:888888@192.168.199.174:10554/udp/av0_0";

    if (!vcap.open(videoStreamAddress)) 
    {
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    }

    cv::namedWindow("Output Window");

    for (;;) {
        if (!vcap.read(image)) {
            std::cout << "No frame" << std::endl;
            cv::waitKey();
        }
        cv::imshow("Output Window", image);
        if (cv::waitKey(1) >= 0) break;
    }
}

 

posted on 2017-08-23 17:00  LuoTian  阅读(553)  评论(0编辑  收藏  举报