VC ++中的视频捕获 [英] video capturing in VC++

查看:67
本文介绍了VC ++中的视频捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何存储捕获的视频

推荐答案

在摄像机中捕获的日期是RGB数据.
您存储什么格式?
The date that capture in camera is RGB data.
What format do you store?


1.创建MFC项目.

2.在对话框中,创建一个Picture控件和一个Button,Picture控件将显示Video流,并且该按钮将用于捕获快照.更改Picture控件以键入Bitmap并将CStatic变量附加到该控件.

3.现在,我们将使用一个简单的计时器(WM_TIMER)更新捕获的图像,这是一种更好的方法,但这对于教程来说应该做到.在OnInitDialog()中,将计时器设置为每秒刷新10次,
SetTimer(NULL,100,NULL)

4.包括视频videoInput.h头文件.还要在链接器输入中添加videoinput.lib,并忽略库atlthunk.lib(如果它导致错误).

5.使用VideoInput API初始化设备.

//在标题中
int设备,宽度,高度,大小;
videoInput VI;
unsigned char * captureBuffer;
//在InitDoalog中
设备= 0; //第一个网络摄像头
VI.setupDevice(设备320,240); //320 x 240分辨率
width = VI.getWidth(device);
高度= VI.getHeight(设备);
大小= VI.getSize(设备); //初始化缓冲区的大小
captureBuffer =新的无符号char [size]; //我们的CaptureBuffer

6.现在让我们在OnTimer中捕获视频并显示帧

if(VI.isFrameNew(device))
{
VI.getPixels(device,captureBuffer,false,true);
DisplayImage(& m_webcam,height,width,captureBuffer);
}
1. Create MFC project.

2. In the dialog make a Picture control and a Button , Picture control will Display the Video stream and the button will be used to capture a snapshot.Change Picture control to type Bitmap and attach a CStatic variable to it.

3. Now we will use a simple timer ( WM_TIMER ) to update the image being captured there are better way but this should do for a tutorial. In OnInitDialog() set the timer to refresh at say 10 times a second,
SetTimer(NULL,100,NULL)

4. Include the video videoInput.h header file. Also add the videoinput.lib in the linker input and for ignore library atlthunk.lib ( if it causes errors ).

5. Initialize the device using VideoInput API .

// in header
int device,width,height,size;
videoInput VI;
unsigned char * captureBuffer;
// in InitDoalog
device = 0; // first webcam
VI.setupDevice(device,320,240); // 320 x 240 resolution
width = VI.getWidth(device);
height = VI.getHeight(device);
size = VI.getSize(device); // size to initialize buffer
captureBuffer = new unsigned char[size]; // our capturebuffer

6. Now lets capture video and display frame in the OnTimer

if(VI.isFrameNew(device))
{
VI.getPixels(device,captureBuffer, false, true);
DisplayImage(&m_webcam,height,width,captureBuffer);
}


这篇关于VC ++中的视频捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆