C# Class Accord.Video.Kinect.KinectDepthCamera

Video source for Microsoft Kinect's depth sensor.

The video source captures depth data from Microsoft Kinect depth sensor, 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 freenect.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 KinectDepthCamera videoSource = new KinectDepthCamera( 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: accord-net/framework Class Usage Examples

Private Properties

Property Type Description
HandleDataReceived void

Public Methods

Method Description
KinectDepthCamera ( int deviceID ) : System

Initializes a new instance of the KinectDepthCamera class.

KinectDepthCamera ( int deviceID, CameraResolution resolution ) : System

Initializes a new instance of the KinectDepthCamera class.

KinectDepthCamera ( int deviceID, CameraResolution resolution, bool provideOriginalDepthImage ) : System

Initializes a new instance of the KinectDepthCamera 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 stop 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 depthData, UInt32 timestamp ) : void

Method Details

KinectDepthCamera() public method

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

KinectDepthCamera() public method

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

KinectDepthCamera() public method

Initializes a new instance of the KinectDepthCamera class.
public KinectDepthCamera ( int deviceID, CameraResolution resolution, bool provideOriginalDepthImage ) : System
deviceID int Kinect's device ID (index) to connect to.
resolution CameraResolution Resolution of depth sensor to set.
provideOriginalDepthImage bool Provide original depth image or colored depth map /// (see property).
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 depth sensor. Could not connect to Kinect's depth sensor. Another connection to the specified depth sensor is already running.
public Start ( ) : void
return void

Stop() public method

Stop video source.

The method stop 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