- 1、本文档共10页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
VideoCapure类和H263笔记
Displaying the Captured Video Frame
There are various methods and APIs for displaying the captured frame. You can use SetDIBitsToDevice() method to directly display the frame. But this is quite slow as it is based on Graphics Device Interface (GDI) functions. The better method is to use DrawDib API to draw the frame. The DrawDib functions provide high performance image-drawing capabilities for device-independent bitmaps (DIBs). DrawDib functions write directly to video memory, hence provide better performance.
MSDN:The capPreview macro enables or disables preview mode. In preview mode, frames are transferred from the capture hardware to system memory and then displayed in the capture window using GDI functions
BOOL capPreview(
hwnd,
f
);
Here is the brief view of how to use DrawDib API to display frame:
Collapse HYPERLINK file:///E:\\BetterI\\otherproj\\H263pangzai\\netdown\\VideoNet%20-%20CodeProject.mht Copy Code
// Initialize DIB for drawing...
HDRAWDIB hdib=::DrawDibOpen();
// Then call this function will suitable parameters....
::DrawDibBegin(hdib,...);
// Now if you are ready with frame data just
// invoke this function to display the frame
::DrawDibDraw(hdib,...);
// Finally termination...
::DrawDibEnd(hdib);
::DrawDibClose(hdib);
VFWcamerea工程:
使用capCreateCaptureWindow关联一个窗口进行视频显示。
// 设置预览窗口
CWnd *pWnd=AfxGetMainWnd()-GetDlgItem(IDC_VIDEO);
//得到预览窗口指针,为Animate控件
CRect rect;
pWnd-GetWindowRect(rect); // 得到窗口大小
m_hCapWnd=capCreateCaptureWindow(Capture,
WS_CHILD|WS_VISIBLE,
0,0,
rect.Width(),rect.Width(),
pWnd-GetSafeHwnd(),0); // 设置预览窗口
if(!m_hCapWnd)
{
MessageBox(Set preview window failed!);
return FALSE;
}
// 连接摄像头
if(!capDriverConnect(m_hCapWnd,0))
{
MessageBox(Connect to Camera failed!);
return FALSE;
}
//得到驱动器的属性
capDriverGetCaps(m_hCapWnd,sizeof(CAPDRIVERCAPS), m_CapDrvCap);
if(m_CapDrvCap.fCaptureInitialized) // 查看摄像头是否初始化成功
{
capGetStatus(m_hCapWnd, m_CapStatus,sizeof(m_CapStatus));
// 得
文档评论(0)