我有两个问题
1 我的思路是用directshow 把采集卡的视频每一帧帧转换成图片,然后逐帧用算法处理,这是不是可行,好有别的方法吗?
2 因为要验证算法实时性,想处理的同时显示视频跟踪结果,比如有个十字跟着目标走。所以这时视频播放是不是将处理完后图片一个个的快速显示出来就可以完成视频播放了呀,现实图片用graph或者bitblt函数什么的吗。
1 我的思路是用directshow 把采集卡的视频每一帧帧转换成图片,然后逐帧用算法处理,这是不是可行,好有别的方法吗?
2 因为要验证算法实时性,想处理的同时显示视频跟踪结果,比如有个十字跟着目标走。所以这时视频播放是不是将处理完后图片一个个的快速显示出来就可以完成视频播放了呀,现实图片用graph或者bitblt函数什么的吗。
2.这个是可以的,就算法处理后把你的跟踪标示再图像里标记下,然后显示就可以了,没有问题。
如何把ds采集到的视频做成想要的形式的图片然后实时处理 然后还能实时显示吗?
我最近在做这方面的东西 。我是用visual studio2005,基于ds采集视频。现在问题是视频可以采到,也用samplegrabber 抓到了图像,但只是一帧 。
现在想达到连续抓图然后处理在显示(实时)的效果,怎么做比较好呢?
<ddrawex.h>了,怎么回事呢?
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1994 - 1998 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;
//// MovieView.h : interface of the CMovieView class
// aze
// (c) Stephane Rodriguez 98
/////////////////////////////////////////////////////////////////////////////#if !defined(AFX_MOVIEVIEW_H__8F3E666D_3B66_11D2_92F7_00104B498E9D__INCLUDED_)
#define AFX_MOVIEVIEW_H__8F3E666D_3B66_11D2_92F7_00104B498E9D__INCLUDED_#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000/////////////////////////////////////////////////////////////////////////////
// CMovieApp:
// See MovieWinBackMFC.cpp for the implementation of this class
//// This application uses a Multimedia stream to render
// a video file to a DirectDrawEx surface contained in
// a window. It implements a primary DirectDraw surface
// and an offscreen DirectDraw surface to optimize individual
// frame blits. It also attaches a DirectDraw clipper to the
// window to process window overlapping.
//To compile this program you must have DXMedia SDK 5.1 installed
//and you will need set your include path under tools/options/directories/include
//to c:\DXMedia\include and your library path to c:\DXMedia\lib
//Also link with the following libraries under project/settings/link...
//amstrmid.lib quartz.lib strmbase.lib ddraw.lib #include <ddstream.h> // DirectDraw multimedia stream interfaces
#include <ddrawex.h> // DirectDrawEx interfaces#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>#include <stdio.h>class CMovieView : public CView
{
protected: // create from serialization only
CMovieView();
DECLARE_DYNCREATE(CMovieView)// Attributes
public:
CMovieDoc* GetDocument();protected :
BOOL m_bAppactive, // The mmstream is rendering ?
m_bFileLoaded, // There is a file loaded ?
m_bPaused; // The movie has been paused ? WORD m_video_width, m_video_height;
TCHAR m_szFilename[MAX_PATH];
STREAM_TIME m_StreamTime; // Stream time of the movie file //DirectDrawEx interfaces
IDirectDraw *m_pDD;
// IDirectDraw3 *m_pDD3;
IDirectDrawFactory *m_pDDF;
IDirectDraw *m_pDD3;
// IDirectDraw *m_pDDF;
IDirectDrawSurface *m_pPrimarySurface;
IDirectDrawSurface *m_pDDSOffscreen;
IDirectDrawSurface *m_pDDSOffscreen2;
IDirectDrawClipper *m_pDDClipper; //MultiMedia streaming interfaces
IMultiMediaStream *m_pMMStream;
IMediaStream *m_pPrimaryVidStream;
IDirectDrawMediaStream *m_pDDStream;
IDirectDrawStreamSample *m_pSample;
// (can't use CComPtr here because of multiple instanciations : open a video, then another, ...)// Operations
protected : HRESULT InitDDrawEx();
BOOL GetOpenMovieFile(LPSTR szName);
HRESULT RenderFileToMMStream(LPCTSTR szFilename);
HRESULT InitRenderToSurface();
void switchPlayPause();
void DestroyObjects();
void ExitCode();public : void RenderToSurface(BOOL bSingleBlit=TRUE);
// Implementation
public:
virtual ~CMovieView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endifprotected:// Generated message map functions
protected:
//{{AFX_MSG(CMovieView)
// NOTE - the ClassWizard will add and remove member functions here.
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
BOOL OnEraseBkgnd( CDC* pDC ); afx_msg void OnFileOpen();
// afx_msg void OnStart();
// afx_msg void OnPause();
// afx_msg void OnStop();
// afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
// afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};#ifndef _DEBUG // debug version in MovieView.cpp
inline CMovieDoc* CMovieView::GetDocument()
{ return (CMovieDoc*)m_pDocument; }
#endif///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.#endif // !defined(AFX_MOVIEVIEW_H__8F3E666D_3B66_11D2_92F7_00104B498E9D__INCLUDED_)