|
我想读取视频文件,然后在静态文本里显示!!
程序如下::
- void CRecogniseDlg::OnButtonRecognise()
- {
- CvvImage *trail=0;
- IplImage *src=0;
- CString filename;
- CvCapture * capture=0;
- // TODO: Add your control notification handler code here
- CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,NULL);
- if(dlg.DoModal()==IDOK)
- filename.Format("%s",dlg.GetPathName());
- capture=cvCaptureFromFile(filename);
- CWnd *pwnd=GetDlgItem(IDC_STATIC_DISPLAY);
- CDC *pdc=pwnd->GetDC();
- for(;;)
- {
- src=cvQueryFrame(capture);
- trail->CopyOf(src);
- HDC hdc=pdc->GetSafeHdc();
- CRect rect(0,0,trail->Width(),trail->Height());
- trail->DrawToHDC(hdc,&rect);
- //trail->Show(hdc,0,0,trail->Width(),trail->Height(),0,0);
- if( cvWaitKey(2) >= 0 )
- break;
-
- }
-
- cvReleaseCapture(&capture);
- }
- 现在编译没有问题,就是显示时出现错误!!
- 请高手指点!!!!谢谢!!
复制代码 |
|