[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
>class?
>  
>
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.
source->SetOutputFormatToLuminance();

// 15 frames/sec
source->SetFrameRate(15);                               

// Set parameter in frame grabber hardware, mainly
source->Initialize();

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

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

If you have any more questions, please ask.

s.



More information about the vtkusers mailing list