Advertisement

C# 笔记本电脑内置摄像头系统视频播放及存储

阅读量:

软件环境配置:

系统环境:WIN10

开发环境:VS2017

opencv:opencv3.4.0

本实例的作用:

  1. 读取摄像头或者本地视频数据进行播放

  2. 写入视频数据

  3. 读取图片在子窗口显示、resize等

名称函数 playVideoFromCam()
{
//通过摄像头获取视频流
VideoCapture videoCamera(0);
//使用内置摄像头(索引号为 0 表示笔记本电脑内置摄像头)
while (true)
{
Mat currentFrame;
//读取当前帧
videoCamera >> currentFrame;
//调整图像尺寸
resize(currentFrame, currentFrame, Size(360, 240));
//转换颜色空间
cvtColor(currentFrame, currentFrame, COLOR_BGR2GRAY);
//显示窗口
imshow("AA", curren

全部评论 (0)

还没有任何评论哟~