用VC编写点对点视频会议程序
2008-11-12 19:26:46 来源:WEB开发网视频捕获
使用VFW(Video For Windows)API进行视频捕获,它提供了通过webcam进行视频捕获。VideoCapture.h 和VideoCapture.cpp包含了处理视频捕获的代码。
如下代码说明了如何使用该类:
// Create instance of Class vidcap=new VideoCapture();
// This is later used to call display function of the main
// dialog class when the frame is captured... vidcap->SetDialog(this);
// This does lot of work, including connecting to the driver
// and setting the desired video format. Returns TRUE if
// successfully connected to videocapture device. vidcap->Initialize();
// If successfully connected, you can get the BITMAPINFO
// structure associated with the video format. This is later
// used to display the captured frame... this->m_bmpinfo=&vidcap->m_bmpinfo;
// Now you can start the capture.... vidcap->StartCapture();
// Once capture is started, frames will arrive in the "OnCaptureVideo"
// callback function of the VideoCapture class. Here you call the
// display function to display the frame.
// To stop the capture vidcap->StopCapture();
// If your job is over....just destroy it.. vidcap->Destroy();
要使以上代码通过编译,你应该链接适当的库:
#pragma comment(lib,"vfw32")
#pragma comment(lib,"winmm")
更多精彩
赞助商链接