zoukankan      html  css  js  c++  java
  • VC VFWcamera 和 VideoCapH263笔记

    内容参考:

    http://www.codeproject.com/KB/IP/videonet.aspx

    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.

    MSDNThe 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:

    VFWcamerea工程:

    使用capCreateCaptureWindow关联一个窗口进行视频显示。

    使用capPreview来预览、显示视频

    //**********************************************************************************//*********************************************************************************

    VideoCap工程:

    使用VideoCapture.h and VideoCapture.c实现,其定义了一个VideoCapture类。

    初始化VideoCapture类,在vidcap->Initialize()中设置了一个回调函数:

    capSetCallbackOnVideoStream(m_capwnd,OnCaptureVideo);

    capSetCallbackOnVideoStream

    The capSetCallbackOnVideoStream macro sets a callback function in the application. AVICap calls this procedure during streaming capture when a video buffer is filled.

    在视频流获取的过程中,当一个视频缓冲区慢之后,AVICap会调用这个回调函数。

    初始化DIB

    点击Start按钮,会开始视频获取

    然后,在视频流获取的过程,当视频缓冲区满之后,会调用回调函数OnCaptureVideo

    在回调函数里又会调用Dialog类中的DisplayVideo函数

    得到IDC_VIDEO所在的矩形区域:

    将坐标原点放在矩形区域的中心:

    设置窗口的z轴显示,放在z轴的最上层,-4+9可以使视频边框不闪,具体什么原因还没弄清楚。

    得到DialogDC,显示内容:

    将前面初始化好的DIB与这里的DC关联,同时也与视频的数据关联:

     

    Encoder and Decoder Library

    Encoder

    I have used fast h.263 encoder library for the encoding. This library was the modified version of Tmndecoder to make it more faster for real time encoding. I have converted this library from C to C++ so that it can be integrated into any Windows application easily. I have removed some of the unnecessary codes/files from the fast h263 library. Also moved definitions and declarations in their proper .h and .cpp files.

    Brief view of usage of H263 Encoder library

    Decoder

    This is the modified version of tmndecoder (H.263 decoder). It was in ANSI C. I have converted it into C++ so that it can be integrated into any Windows application. I have removed some of the files which had display and file storing functions. I have removed the unnecessary code and also added some new files.

    Original library dealt with files. It was not suitable to use for real time decoding. I have done some major changes so that it can be easily integrated into the application for real time decoding process. Now one can use this library for decoding H263 frames. This library is quite fast and gives better performance.

    Usage of Decoder .....

  • 相关阅读:
    电子论文写作不发愁
    美化 Blog
    The problem with install redhat linux
    Unknown hard error.stop:c000021a.
    .NET集合类:定义,用途及使用条件
    linux ftp 命令详解
    [转]MVC和MVP的区别
    一次谷歌面试趣事(转)
    全文索引原理及其示例(sqlserver)【转】
    “什么是团队精神”——《海贼王》里的一段台词
  • 原文地址:https://www.cnblogs.com/yanhc/p/2175252.html
Copyright © 2011-2022 走看看