OpenCV 取网络摄像头 rtsp视频流

//不同厂家rtsp的url格式: 账号:密码@网段
 String url = "rtsp://admin:[email protected]/ch1-s1?tcp";        //海康
//"rtsp://admin:[email protected]/ch1-s1?tcp"        //大华
//“rtsp://admin:[email protected]/cam/realmonitor?channel=1&subtype=1?tcp”//宇视
//"rtsp://admin:[email protected]/video1?tcp"

VideoCapture cap(url);

#include 
using namespace cv;

int main()
{
    VideoCapture cap("rtsp://admin:mima@wangzhi/ch1-s1?tcp"); //示例
    Mat src;

    while (1)
    {
        cap >> src;

        imshow("src", src);
        waitKey(1);
    }
}

你可能感兴趣的:(opencv,opencv)