赞
踩
/************************************************************************* > File Name: 打开大华网络摄像头 ************************************************************************/ #include <stdio.h> #include <opencv2/opencv.hpp> #include <opencv2/core/core.hpp> #include <iostream> #include <string> using namespace cv; using namespace std; int main() { cv::VideoCapture vcap; cv::Mat image; //网络链接地址 const string videoStreamAddress = "rtsp://admin:admin888@10.61.170.88/cam/realmonitor?channel=1&subtype=0"; //admin,admin888是登录摄像头的用户名和密码。IP地址是10.61.170.88,根据自己实际情况修改。 if (!vcap.open(videoStreamAddress)) { std::cout << "Error opening video stream or file"<< std::endl; system("pause"); return -1; } cv::namedWindow("Output Window"); while (1) { for (;;) { if (!vcap.read(image)) { std::cout << "No frame" << std::endl; cv::waitKey(); } cv::imshow("Output Window", image); if (cv::waitKey(1) >= 0) break; } } waitKey(0); vcap.~VideoCapture(); return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。