linux 获取摄像头视频,OpenCV3读取视频或摄像头

本文档介绍了如何使用OpenCV3在Linux环境下读取视频文件或摄像头数据。通过示例代码展示了如何打开视频文件或默认摄像头,并进行实时显示,同时讲解了OpenCV中的CommandLineParser类用于命令行参数管理的方法。
摘要由CSDN通过智能技术生成

我们可以利用OpenCV读取视频文件或者摄像头的数据,将其保存为图像,以用于后期处理。下面的实例代码展示了简单的读取和显示操作:

// This is a demo introduces you to reading a video and camera

#include

#include

#include

using namespace std;

// OpenCV includes

#include

#include

#include // for camera

using namespace cv;

// OpenCV command line parser functions

// Keys accepted by command line parser

const char* keys =

{

"{help h usage ? | | print this message}"

"{@video | | Video file, if not defined try to use webcamera}"

};

int main(int argc, const char** argv)

{

CommandLineParser parser(argc, argv, keys);

parser.about("Reading a video and camera v1.0.0");

// If requires help show

if (parser.has("help"))

{

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值