C# Class AForge.Video.Kinect.KinectVideoCamera

Video source for Microsoft Kinect's video camera.

The video source captures video data from Microsoft Kinect video camera, which is aimed originally as a gaming device for XBox 360 platform.

Prior to using the class, make sure you've installed Kinect's drivers as described on Open Kinect project's page.

In order to run correctly the class requires libfreenect.dll library to be put into solution's output folder. This can be found within the AForge.NET framework's distribution in Externals folder.

Sample usage:

// create video source KinectVideoCamera videoSource = new KinectVideoCamera( 0 ); // set NewFrame event handler videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source videoSource.Start( ); // ... 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
KinectVideoCamera ( int deviceID ) : System

Initializes a new instance of the KinectVideoCamera class.

KinectVideoCamera ( int deviceID, CameraResolution resolution ) : System

Initializes a new instance of the KinectVideoCamera class.

KinectVideoCamera ( int deviceID, CameraResolution resolution, VideoCameraMode cameraMode ) : System

Initializes a new instance of the KinectVideoCamera class.

SignalToStop ( ) : void

Signal video source to stop its work.

Calling this method is equivalent to calling Stop for Kinect video camera.

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.

Calling this method is equivalent to calling Stop for Kinect video camera.

Private Methods

Method Description
HandleDataReceived ( IntPtr device, IntPtr imageData, UInt32 timeStamp ) : void

Method Details

KinectVideoCamera() public method

Initializes a new instance of the KinectVideoCamera class.
public KinectVideoCamera ( int deviceID ) : System
deviceID int Kinect's device ID (index) to connect to.
return System

KinectVideoCamera() public method

Initializes a new instance of the KinectVideoCamera class.
public KinectVideoCamera ( int deviceID, CameraResolution resolution ) : System
deviceID int Kinect's device ID (index) to connect to.
resolution CameraResolution Resolution of video camera to set.
return System

KinectVideoCamera() public method

Initializes a new instance of the KinectVideoCamera class.
public KinectVideoCamera ( int deviceID, CameraResolution resolution, VideoCameraMode cameraMode ) : System
deviceID int Kinect's device ID (index) to connect to.
resolution CameraResolution Resolution of video camera to set.
cameraMode VideoCameraMode Sets video camera mode.
return System

SignalToStop() public method

Signal video source to stop its work.

Calling this method is equivalent to calling Stop for Kinect video camera.

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.
The specified resolution is not supported for the selected /// mode of the Kinect video camera. Could not connect to Kinect's video camera. Another connection to the specified video camera is already running.
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.

Calling this method is equivalent to calling Stop for Kinect video camera.

public WaitForStop ( ) : void
return void