VideoCapure类和H263笔记.docVIP

  • 5
  • 0
  • 约8.85万字
  • 约 10页
  • 2016-12-03 发布于河南
  • 举报
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)

1亿VIP精品文档

相关文档