[vtkusers] Re: Some question of the using of vtkWin32VideoSource
dgobbi at irus.rri.on.ca
Mon May 21 13:14:33 EDT 2001
The problem is that while the 'for' loop is running, Windows is unable
to process events. This is not a problem with e.g. the
vtkMILVideoSource because the MIL interface is multi-threaded, but
unfortunately Video for Windows relies on Windows event handling to
process the callbacks.
The only solution is for you write a program that does proper event
handling. If you call Grab from somewhere within your main WNDPROC
message handler, then Video for Windows won't be blocked.
Does anyone out there who has used vtkWin32VideoSource have a simple
example of this? I don't do much applications-level programming
in C++ myself.
Another solution is to write your program in tcl or python/Tkinter
and to only do the grabs after you have started the 'mainloop'.
See 'video.tcl' for an example.
David Gobbi, MSc dgobbi at irus.rri.on.ca
Advanced Imaging Research Group
Robarts Research Institute, University of Western Ontario
On Mon, 21 May 2001, zhangzhijun wrote:
> Dear all:
> When using the vtkWin32VideoSource, I find some question, I want to
> whether you can help me to overcome them:
> I use this code to display a video from the camera, this is the
> I think every time when a vtkWin32VideoSource object is created , it must be
> in the program otherwise the hardware will not be accessed next time when
> the application
> is executed. I encounter this kind of question, in which every time there
> will be a
> message box saying"can't find video hardware". because I use a for loop in
> program and it seems it's a infinite loop because when I close the window,
> and I open
> the window again, I will be give this "can't find video hardware"
> information . but How
> to solve it?
> void main( int argc, char *argv )
> vtkRenderer *ren = vtkRenderer::New();
> vtkRenderWindow *renWindow = vtkRenderWindow::New();
> renWindow->SetSize( 320, 240 );
> vtkRenderWindowInteractor *Interactor=vtkRenderWindowInteractor::New();
> vtkWin32VideoSource *videoSource=vtkWin32VideoSource::New();
> vtkImageViewer *imageViewer=vtkImageViewer::New();
> vtkImageData* imageData=vtkImageData::New();
> vtkImageMapper* imageMapper=vtkImageMapper::New();
> vtkActor2D *actor=vtkActor2D::New();
> for (int i=0;i=1;i++)
> if (videoSource)
> if (imageViewer)
> zj zhang
More information about the vtkusers