OpenCv通过RTSP预览大华摄像机视频

栏目: 编程工具 · 发布时间: 7年前

内容简介:一、配置大华摄像机参数检查RTSP端口号

一、配置大华摄像机参数

检查RTSP端口号

OpenCv通过RTSP预览大华摄像机视频

修改分辨率,在这里我们主要设置【辅码流】

OpenCv通过RTSP预览大华摄像机视频

大华RTSP协议解释

访问主码流

rtsp://admin:a12345678@192.168.1.108:554/cam/realmonitor?channel=1&subtype=0

访问辅码流

rtsp://admin:a12345678@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1

更多详细参数说明请参考浙江大华的知识库:

https://400chat.dahuatech.com/EliteKM/newpages/index.jsp

二、参考示例代码

#include "pch.h"
#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main()
{
	VideoCapture cap;

	namedWindow("Camera", CV_WINDOW_AUTOSIZE);	
	//主码流
	//cap.open("rtsp://admin:a12345678@192.168.1.108:554/cam/realmonitor?channel=1&subtype=0");

	//辅码流
	cap.open("rtsp://admin:a12345678@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1");
	Mat Camera_CImg;
	Mat Camera_GImg;
	cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
	cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
	if (!cap.isOpened())
		return -1;

	while (1)
	{
		cap >> Camera_CImg;
		if (Camera_CImg.empty())
			break;
		cvtColor(Camera_CImg, Camera_GImg, CV_RGB2GRAY);
		imshow("Camera", Camera_CImg);
		if (cvWaitKey(10) == 'q')
			break;
	}
	system("pause");
	return 0;
}

三、运行效果

OpenCv通过RTSP预览大华摄像机视频

本系列文章由张建波编写,转载请注明出处。

示例代码下载地址

https://download.csdn.net/download/ex_net/10791499


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications

Kenneth H Rosen / McGraw-Hill Science/Engineering/Math / 2003-04-22 / USD 132.81

Discrete Mathematics and its Applications is a focused introduction to the primary themes in a discrete mathematics course, as introduced through extensive applications, expansive discussion, and deta......一起来看看 《Discrete Mathematics and Its Applications》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

html转js在线工具
html转js在线工具

html转js在线工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具