FreeMat

- Main Page
- Related Pages

vtkVideoSource

Section: Visualization Toolkit Hybrid Classes

# Usage

vtkVideoSource is a superclass for video input interfaces for VTK. The goal is to provide an interface which is very similar to the interface of a VCR, where the 'tape' is an internal frame buffer capable of holding a preset number of video frames. Specialized versions of this class record input from various video input sources. This base class records input from a noise source.

To create an instance of class vtkVideoSource, simply invoke its constructor as follows

      obj = vtkVideoSource

# Methods

The class vtkVideoSource has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkVideoSource class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkVideoSource = obj.NewInstance ()`
- `vtkVideoSource = obj.SafeDownCast (vtkObject o)`
- `obj.Record ()` - Record incoming video at the specified FrameRate. The recording continues indefinitely until Stop() is called.
- `obj.Play ()` - Play through the 'tape' sequentially at the specified frame rate. If you have just finished Recoding, you should call Rewind() first.
- `obj.Stop ()` - Stop recording or playing.
- `obj.Rewind ()` - Rewind to the frame with the earliest timestamp. Record operations will start on the following frame, therefore if you want to re-record over this frame you must call Seek(-1) before calling Grab() or Record().
- `obj.FastForward ()` - FastForward to the last frame that was recorded (i.e. to the frame that has the most recent timestamp).
- `obj.Seek (int n)` - Seek forwards or backwards by the specified number of frames (positive is forward, negative is backward).
- `obj.Grab ()` - Grab a single video frame.
- `int = obj.GetRecording ()` - Are we in record mode? (record mode and play mode are mutually exclusive).
- `int = obj.GetPlaying ()` - Are we in play mode? (record mode and play mode are mutually exclusive).
- `obj.SetFrameSize (int x, int y, int z)` - Set the full-frame size. This must be an allowed size for the device, the device may either refuse a request for an illegal frame size or automatically choose a new frame size. The default is usually 320x240x1, but can be device specific. The 'depth' should always be 1 (unless you have a device that can handle 3D acquisition).
- `obj.SetFrameSize (int dim[3])` - Set the full-frame size. This must be an allowed size for the device, the device may either refuse a request for an illegal frame size or automatically choose a new frame size. The default is usually 320x240x1, but can be device specific. The 'depth' should always be 1 (unless you have a device that can handle 3D acquisition).
- `int = obj. GetFrameSize ()` - Set the full-frame size. This must be an allowed size for the device, the device may either refuse a request for an illegal frame size or automatically choose a new frame size. The default is usually 320x240x1, but can be device specific. The 'depth' should always be 1 (unless you have a device that can handle 3D acquisition).
- `obj.SetFrameRate (float rate)` - Request a particular frame rate (default 30 frames per second).
- `float = obj.GetFrameRate ()` - Request a particular frame rate (default 30 frames per second).
- `obj.SetOutputFormat (int format)` - Set the output format. This must be appropriate for device, usually only VTK_LUMINANCE, VTK_RGB, and VTK_RGBA are supported.
- `obj.SetOutputFormatToLuminance ()` - Set the output format. This must be appropriate for device, usually only VTK_LUMINANCE, VTK_RGB, and VTK_RGBA are supported.
- `obj.SetOutputFormatToRGB ()` - Set the output format. This must be appropriate for device, usually only VTK_LUMINANCE, VTK_RGB, and VTK_RGBA are supported.
- `obj.SetOutputFormatToRGBA ()` - Set the output format. This must be appropriate for device, usually only VTK_LUMINANCE, VTK_RGB, and VTK_RGBA are supported.
- `int = obj.GetOutputFormat ()` - Set the output format. This must be appropriate for device, usually only VTK_LUMINANCE, VTK_RGB, and VTK_RGBA are supported.
- `obj.SetFrameBufferSize (int FrameBufferSize)` - Set size of the frame buffer, i.e. the number of frames that the 'tape' can store.
- `int = obj.GetFrameBufferSize ()` - Set size of the frame buffer, i.e. the number of frames that the 'tape' can store.
- `obj.SetNumberOfOutputFrames (int )` - Set the number of frames to copy to the output on each execute. The frames will be concatenated along the Z dimension, with the most recent frame first. Default: 1
- `int = obj.GetNumberOfOutputFrames ()` - Set the number of frames to copy to the output on each execute. The frames will be concatenated along the Z dimension, with the most recent frame first. Default: 1
- `obj.AutoAdvanceOn ()` - Set whether to automatically advance the buffer before each grab. Default: on
- `obj.AutoAdvanceOff ()` - Set whether to automatically advance the buffer before each grab. Default: on
- `obj.SetAutoAdvance (int )` - Set whether to automatically advance the buffer before each grab. Default: on
- `int = obj.GetAutoAdvance ()` - Set whether to automatically advance the buffer before each grab. Default: on
- `obj.SetClipRegion (int r[6])` - Set the clip rectangle for the frames. The video will be clipped before it is copied into the framebuffer. Changing the ClipRegion will destroy the current contents of the framebuffer. The default ClipRegion is (0,VTK_INT_MAX,0,VTK_INT_MAX,0,VTK_INT_MAX).
- `obj.SetClipRegion (int x0, int x1, int y0, int y1, int z0, int z1)` - Set the clip rectangle for the frames. The video will be clipped before it is copied into the framebuffer. Changing the ClipRegion will destroy the current contents of the framebuffer. The default ClipRegion is (0,VTK_INT_MAX,0,VTK_INT_MAX,0,VTK_INT_MAX).
- `int = obj. GetClipRegion ()` - Set the clip rectangle for the frames. The video will be clipped before it is copied into the framebuffer. Changing the ClipRegion will destroy the current contents of the framebuffer. The default ClipRegion is (0,VTK_INT_MAX,0,VTK_INT_MAX,0,VTK_INT_MAX).
- `obj.SetOutputWholeExtent (int , int , int , int , int , int )` - Get/Set the WholeExtent of the output. This can be used to either clip or pad the video frame. This clipping/padding is done when the frame is copied to the output, and does not change the contents of the framebuffer. This is useful e.g. for expanding the output size to a power of two for texture mapping. The default is (0,-1,0,-1,0,-1) which causes the entire frame to be copied to the output.
- `obj.SetOutputWholeExtent (int a[6])` - Get/Set the WholeExtent of the output. This can be used to either clip or pad the video frame. This clipping/padding is done when the frame is copied to the output, and does not change the contents of the framebuffer. This is useful e.g. for expanding the output size to a power of two for texture mapping. The default is (0,-1,0,-1,0,-1) which causes the entire frame to be copied to the output.
- `int = obj. GetOutputWholeExtent ()` - Get/Set the WholeExtent of the output. This can be used to either clip or pad the video frame. This clipping/padding is done when the frame is copied to the output, and does not change the contents of the framebuffer. This is useful e.g. for expanding the output size to a power of two for texture mapping. The default is (0,-1,0,-1,0,-1) which causes the entire frame to be copied to the output.
- `obj.SetDataSpacing (double , double , double )` - Set/Get the pixel spacing. Default: (1.0,1.0,1.0)
- `obj.SetDataSpacing (double a[3])` - Set/Get the pixel spacing. Default: (1.0,1.0,1.0)
- `double = obj. GetDataSpacing ()` - Set/Get the pixel spacing. Default: (1.0,1.0,1.0)
- `obj.SetDataOrigin (double , double , double )` - Set/Get the coordinates of the lower, left corner of the frame. Default: (0.0,0.0,0.0)
- `obj.SetDataOrigin (double a[3])` - Set/Get the coordinates of the lower, left corner of the frame. Default: (0.0,0.0,0.0)
- `double = obj. GetDataOrigin ()` - Set/Get the coordinates of the lower, left corner of the frame. Default: (0.0,0.0,0.0)
- `obj.SetOpacity (float )` - For RGBA output only (4 scalar components), set the opacity. This will not modify the existing contents of the framebuffer, only subsequently grabbed frames.
- `float = obj.GetOpacity ()` - For RGBA output only (4 scalar components), set the opacity. This will not modify the existing contents of the framebuffer, only subsequently grabbed frames.
- `int = obj.GetFrameCount ()` - This value is incremented each time a frame is grabbed. reset it to zero (or any other value) at any time.
- `obj.SetFrameCount (int )` - This value is incremented each time a frame is grabbed. reset it to zero (or any other value) at any time.
- `int = obj.GetFrameIndex ()` - Get the frame index relative to the 'beginning of the tape'. This value wraps back to zero if it increases past the FrameBufferSize.
- `double = obj.GetFrameTimeStamp (int frame)` - Get a time stamp in seconds (resolution of milliseconds) for a video frame. Time began on Jan 1, 1970. You can specify a number (negative or positive) to specify the position of the video frame relative to the current frame.
- `double = obj.GetFrameTimeStamp ()` - Get a time stamp in seconds (resolution of milliseconds) for the Output. Time began on Jan 1, 1970. This timestamp is only valid after the Output has been Updated.
- `obj.Initialize ()` - Initialize the hardware. This is called automatically on the first Update or Grab.
- `int = obj.GetInitialized ()` - Initialize the hardware. This is called automatically on the first Update or Grab.
- `obj.ReleaseSystemResources ()` - Release the video driver. This method must be called before application exit, or else the application might hang during exit.
- `obj.InternalGrab ()` - The internal function which actually does the grab. You will definitely want to override this if you develop a vtkVideoSource subclass.
- `obj.SetStartTimeStamp (double t)` - And internal variable which marks the beginning of a Record session. These methods are for internal use only.
- `double = obj.GetStartTimeStamp ()` - And internal variable which marks the beginning of a Record session. These methods are for internal use only.