[vtkusers] vtk and video

Simon Drouin sdrouin at bic.mni.mcgill.ca
Mon Jun 6 09:34:12 EDT 2005

Perrine Guillemot wrote:

>Hi everybody,
>Can anyone please explain me how to use vtkVideoSource
>or where can I find some examples for using this
Here's the simplest piece of code you can write to grab a video frame.

/* Create the source. Replace the vtkVideoSource::New() with 
vtkMILVideoSource::New() or vtkWin32VideoSource::New() depending on the 
type of frame grabber you use. */
vtkVideoSource * source = vtkVideoSource::New();

// image size
source->SetFrameSize( 640, 480, 1 );                    

// will output grayscale image.

// 15 frames/sec

// Set parameter in frame grabber hardware, mainly

// Grab a frame to the buffer ( warning: it is not available in the 
output unless you update the pipeline ).

then you can use source->GetOutput() to get the current frame.

If you have any more questions, please ask.


More information about the vtkusers mailing list