C# Class AForge.Robotics.TeRK.Qwerk.Video

Provides access to web camera connected to Qwerk.

The class allows to start Qwerk's camera and continuously receive frames from it. The class creates background thread to poll Qwerk's camera and provides them through NewFrame event. The video frame rate can be configured using FrameInterval property, which sets time interval between frames.

Sample usage:

// get Qwerk's video service Qwerk.Video video = qwerk.GetVideoService( ); // set NewFrame event handler video.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source video.Start( ); // ... // signal to stop video.SignalToStop( ); // ... private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame }
Inheritance: IVideoSource
Datei anzeigen Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
SignalToStop ( ) : void

Signal video source to stop its work.

Signals video source to stop its background thread, stop to provide new frames and free resources.

Start ( ) : void

Start video source.

Starts video source and return execution to caller. Video source object creates background thread and notifies about new frames with the help of NewFrame event.

Stop ( ) : void

Stop video source.

Stops video source aborting its thread.

Since the method aborts background thread, its usage is highly not preferred and should be done only if there are no other options. The correct way of stopping camera is signaling it stop and then waiting for background thread's completion.

Video ( AForge.Robotics.TeRK.Qwerk qwerk )

Initializes a new instance of the Qwerk.Video class.

WaitForStop ( ) : void

Wait for video source has stopped.

Waits for video source stopping after it was signalled to stop using SignalToStop method.

Private Methods

Method Description
Free ( ) : void

Free resource.

WorkerThread ( ) : void

Worker thread.

Method Details

SignalToStop() public method

Signal video source to stop its work.
Signals video source to stop its background thread, stop to provide new frames and free resources.
public SignalToStop ( ) : void
return void

Start() public method

Start video source.
Starts video source and return execution to caller. Video source object creates background thread and notifies about new frames with the help of NewFrame event.
public Start ( ) : void
return void

Stop() public method

Stop video source.

Stops video source aborting its thread.

Since the method aborts background thread, its usage is highly not preferred and should be done only if there are no other options. The correct way of stopping camera is signaling it stop and then waiting for background thread's completion.

public Stop ( ) : void
return void

Video() public method

Initializes a new instance of the Qwerk.Video class.
The passed reference to object is not connected to /// Qwerk board. Failed connecting to the requested service. Failed accessing to the requested service.
public Video ( AForge.Robotics.TeRK.Qwerk qwerk )
qwerk AForge.Robotics.TeRK.Qwerk Reference to object, which is connected to Qwerk board.

WaitForStop() public method

Wait for video source has stopped.
Waits for video source stopping after it was signalled to stop using SignalToStop method.
public WaitForStop ( ) : void
return void