C# Class AForge.Video.Ximea.XimeaVideoSource

The class provides continues access to XIMEA cameras.

The video source class is aimed to provide continues access to XIMEA camera, when images are continuosly acquired from camera and provided throw the NewFrame event. It just creates a background thread and gets new images from XIMEA camera keeping the specified time interval between image acquisition. Essentially it is a wrapper class around XimeaCamera providing IVideoSource interface.

Sample usage:

// create video source for the XIMEA camera with ID 0 XimeaVideoSource videoSource = new XimeaVideoSource( 0 ); // set event handlers videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source videoSource.Start( ); // set exposure time to 10 milliseconds videoSource.SetParam( CameraParameter.Exposure, 10 * 1000 ); // ... // New frame event handler, which is invoked on each new available video frame private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame }
Inheritance: IVideoSource
Show file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
GetParamFloat ( string parameterName ) : float

Get camera's parameter as float value.

The call is redirected to XimeaCamera.GetParamFloat.

GetParamInt ( string parameterName ) : int

Get camera's parameter as integer value.

The call is redirected to XimeaCamera.GetParamFloat.

GetParamString ( string parameterName ) : string

Get camera's parameter as string value.

The call is redirected to XimeaCamera.GetParamString.

SetParam ( string parameterName, float value ) : void

Set camera's parameter.

The call is redirected to XimeaCamera.GetParamFloat.

SetParam ( string parameterName, int value ) : void

Set camera's parameter.

The call is redirected to XimeaCamera.SetParam(string, int).

SignalToStop ( ) : void

Signal video source to stop its work.

Start ( ) : void

Start video source.

Starts video source and returns execution to caller. Video camera will be started and will provide new video frames through the NewFrame event.

Stop ( ) : void

Stop video source.

The method stops the video source, so it no longer provides new video frames and does not consume any resources.

WaitForStop ( ) : void

Wait for video source has stopped.

XimeaVideoSource ( int deviceID ) : System

Initializes a new instance of the XimeaVideoSource class.

Private Methods

Method Description
Free ( ) : void
WorkerThread ( ) : void

Method Details

GetParamFloat() public method

Get camera's parameter as float value.

The call is redirected to XimeaCamera.GetParamFloat.

public GetParamFloat ( string parameterName ) : float
parameterName string Parameter name to get from camera.
return float

GetParamInt() public method

Get camera's parameter as integer value.

The call is redirected to XimeaCamera.GetParamFloat.

public GetParamInt ( string parameterName ) : int
parameterName string Parameter name to get from camera.
return int

GetParamString() public method

Get camera's parameter as string value.

The call is redirected to XimeaCamera.GetParamString.

public GetParamString ( string parameterName ) : string
parameterName string Parameter name to get from camera.
return string

SetParam() public method

Set camera's parameter.

The call is redirected to XimeaCamera.GetParamFloat.

public SetParam ( string parameterName, float value ) : void
parameterName string Parameter name.
value float Float parameter value.
return void

SetParam() public method

Set camera's parameter.

The call is redirected to XimeaCamera.SetParam(string, int).

public SetParam ( string parameterName, int value ) : void
parameterName string Parameter name.
value int Integer parameter value.
return void

SignalToStop() public method

Signal video source to stop its work.

public SignalToStop ( ) : void
return void

Start() public method

Start video source.
Starts video source and returns execution to caller. Video camera will be started and will provide new video frames through the NewFrame event.
There is no XIMEA camera with specified ID connected to the system. An error occurred while communicating with a camera. See error /// message for additional information.
public Start ( ) : void
return void

Stop() public method

Stop video source.

The method stops the video source, so it no longer provides new video frames and does not consume any resources.

public Stop ( ) : void
return void

WaitForStop() public method

Wait for video source has stopped.

public WaitForStop ( ) : void
return void

XimeaVideoSource() public method

Initializes a new instance of the XimeaVideoSource class.
public XimeaVideoSource ( int deviceID ) : System
deviceID int XIMEA camera ID (index) to connect to.
return System