C# Класс 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 }
Наследование: IVideoSource
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Free ( ) : void

Free resource.

WorkerThread ( ) : void

Worker thread.

Описание методов

SignalToStop() публичный метод

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
Результат void

Start() публичный метод

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
Результат void

Stop() публичный метод

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
Результат void

Video() публичный метод

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() публичный метод

Wait for video source has stopped.
Waits for video source stopping after it was signalled to stop using SignalToStop method.
public WaitForStop ( ) : void
Результат void