opencv读取网络摄像头的环境配置 您所在的位置:网站首页 萤石csc3s52wefr说明书 opencv读取网络摄像头的环境配置

opencv读取网络摄像头的环境配置

#opencv读取网络摄像头的环境配置| 来源: 网络整理| 查看: 265

我的环境是ubuntu18.04,在执行opencv的cmake之前先装以下依赖包:

apt install pkg-config apt install ffmpeg apt install libavformat-dev apt install libavcodec-dev apt install libswresample-dev apt install libswscale-dev apt install libavutil-dev apt install libsdl1.2-dev apt install libgtk2.0-dev

其中libgtx是用到了cv::imshow,需要显示输出。

最后在opencv中:

cmake -D WITH_FFMPEG=ON ..

最后,调用示例如下:

#include #include #include #include using namespace std; using namespace cv; int main() { string s_rtsp = "rtsp://admin:[email protected]/Streaming/Channels/1"; VideoCapture camer_cap; camer_cap.open(s_rtsp); //打开视频 if (camer_cap.isOpened()) //如果视频不能正常打开则返回 { //获取指定视频类的相关参数信息 // int width = cap.get(CV_CAP_PROP_FRAME_WIDTH); //帧宽度 //int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //帧高度 //int frameRate = cap.get(CV_CAP_PROP_FPS); //帧率 x frames/s //int totalFrames = cap.get(CV_CAP_PROP_FRAME_COUNT); //总帧数 Mat frame; //定义Mat变量,用来存储每一帧 namedWindow("video"); while (camer_cap.read(frame)) ///读取当前帧方法 { imshow("video", frame);//frame图像尺寸是1080x1920 //显示一帧画面 waitKey(30); ; //延时30ms } } else { cout


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有