从www.vckbase代码仓库中有一个vcap的视频捕捉程序。可以对PC机上安装的摄像头拍摄到的视频画面进行捕捉并播放。我想询问的是视频摄像头输出的数据到底是什么格式的?输出的到底是什么数据?如何得到这些数据呢?在vcap程序中只是创建了一个视频窗口,capCreateWindow和capPreview进行播放,但问题是用capPreview进行播放之前到底是什么数据呢?欢迎大家讨论。

解决方案 »

  1.   

    视频摄像头输出的数据到底是什么格式的
    一般是未压缩的,如YUV系列如I420,UYVY等和RGB系列如RGB16/24/32等,具体可设置
      

  2.   

    BOOL CCapTestDlg::OnInitDialog() 

            CDialog::OnInitDialog(); 
            // Add "About..." menu item to system menu. 
            // IDM_ABOUTBOX must be in the system command range. 
            ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); 
            ASSERT(IDM_ABOUTBOX < 0xF000); 
            CMenu* pSysMenu = GetSystemMenu(FALSE); 
            if (pSysMenu != NULL) 
            { 
                    CString strAboutMenu; 
                    strAboutMenu.LoadString(IDS_ABOUTBOX); 
                    if (!strAboutMenu.IsEmpty()) 
                    { 
                            pSysMenu->AppendMenu(MF_SEPARATOR); 
                            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMeenu); 
                    } 
      
            } 
            // Set the icon for this dialog.  The framework does this automatically 
            //  when the application's main window is not a dialog 
            SetIcon(m_hIcon, TRUE);                 // Set big icon 
            SetIcon(m_hIcon, FALSE);                // Set small icon 
      
      
      
            // TODO: Add extra initialization here 
            gpJpegFile = new JpegFile(); //initializate gpJpegFile; 
            ghDlg = AfxGetMainWnd()->GetSafeHwnd ();   //init ghDlg for callback pro 
      
            CWnd* pWnd=AfxGetMainWnd()->GetDlgItem (IDC_PICT);  //GET the capture wi 
    do 
    w's father windows 
      
            CRect rect; 
            pWnd->GetWindowRect (&rect);   //get rect. 
            ghCapWnd= capCreateCaptureWindow((LPTSTR)"MYCAP",WS_VISIBLE|WS_CHILD 
                    |WS_EX_DLGMODALFRAME,0,0,rect.Width(),rect.Height(), 
                    pWnd->GetSafeHwnd(),0);       //create capture window 
            ASSERT(ghCapWnd); 
            if(capDriverConnect(ghCapWnd,0)){          //connect to Driver 
                    capDriverGetCaps(ghCapWnd,&gCapDrvCaps,sizeof(CAPDRIVERCAPS)); / 
    Get statu 

                    if(gCapDrvCaps.fCaptureInitialized){ 
      
      
                            capPreviewRate(ghCapWnd,33); 
                            capPreview(ghCapWnd,TRUE); 
                            capGetVideoFormat(ghCapWnd,&_bmpInfo,(WORD)sizeof(_bmpIn 
    o)); 
                            capSetCallbackOnFrame(ghCapWnd,FrameCallbackProc); 
                            capSetCallbackOnStatus(ghCapWnd,StatusCallbackProc); 
                    } 
                    else { 
                            AfxMessageBox("&sup2;&para;&raquo;&ntilde;&iquest;¨&sup3;&otilde;&Ecirc;&frac14;&raquo;&macr;&Ecirc;§°&Uuml;"); 
                            AfxGetMainWnd()->PostMessage (WM_CLOSE); 
                    } 
            } 
            else { 
                    AfxMessageBox("&sup2;&para;&raquo;&ntilde;&iquest;¨&Aacute;&not;&frac12;&Oacute;&Ecirc;§°&Uuml;"); 
                    AfxGetMainWnd()->PostMessage (WM_CLOSE); 
            } 
            return TRUE;  // return TRUE  unless you set the focus to a control 

    void CCapTestDlg::OnSysCommand(UINT nID, LPARAM lParam) 

            if ((nID & 0xFFF0) == IDM_ABOUTBOX) 
            { 
                    CAboutDlg dlgAbout; 
                    dlgAbout.DoModal(); 
            } 
            else 
            { 
                    CDialog::OnSysCommand(nID, lParam); 
            } 
    }
      

  3.   

    http://www.naughter.com/download/vfwwnd.zip