opencv:VideoCapture 读取网络摄像头视频图像

VideoCapture 读取视频段或者usb摄像头的方法请参考:
视频段:https://blog.csdn.net/qq_42189368/article/details/80524074

string filename = "D:\\test.avi";

VideoCapture cap0;

cap0.open(filename);

usb摄像头;https://blog.csdn.net/qq_42189368/article/details/80663174

VideoCapture cap0;

cap0.open(0);//设置usb摄像头id

========进入正题==========

 VideoCapture cap0;
  cap0.open("rtsp://192.168.1.223:8554/stream0");

调用网络摄像头的关键就是获取相机URL地址。

获取步骤:

1.下载onvif device manager软件;

https://sourceforge.net/projects/onvifdm/

2.安装软件后,连通相机,打开软件;

3.左侧为搜索到的相机设备列表,点击需要使用的相机;

4.点击Imageing settings ,右侧出现视频图像和信息,右下角的rtsp://192.168.1.223:8554/stream0就是打开网络摄像头需要的信息啦!

5.将4 中获取的信息,加载到开始的opencv中就可以打开网络摄像头啦!

猜你喜欢

转载自blog.csdn.net/qq_42189368/article/details/85050704