C# Класс Accord.Video.Kinect.Kinect

The class provides access to Microsoft's Xbox Kinect controller.

The class allows to manipulate Kinec device by changing its LED color, setting motor's tilt value and accessing its camera. See KinectVideoCamera and KinectDepthCamera classes, which provide access to actual video.

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:

// get Kinect device Kinect kinectDevice = Kinect.GetDevice( 0 ); // change LED color kinectDevice.LedColor = LedColorOption.Yellow; // set motor tilt angle to -10 degrees kinectDevice.SetMotorTilt( -10 ); // get video camera KinectVideoCamera videoCamera = kinectDevice.GetVideoCamera( ); // see example for video camera also
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AddFailureHandler void
CheckDevice void
Dispose void
IsDeviceFailed bool
Kinect System
KinectStatusThread void
Kinect_OnError void
StartStatusThread void
StopStatusThread void

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

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

Dispose device freeing all associated unmanaged resources.

GetAccelerometerValues ( double &x, double &y, double &z ) : void

Get accelerometer values for 3 axes.

Units of all 3 values are m/s2. The g value used for calculations is taken as 9.80665 m/s2.

GetDepthCamera ( ) : KinectDepthCamera

Get Kinect's depth camera.

The method simply creates instance of the KinectDepthCamera class by calling its appropriate constructor. Use KinectDepthCamera.Start method to start the video then.

GetDevice ( int deviceID ) : Kinect

Get initialized instance of the Kinect device.

GetVideoCamera ( ) : KinectVideoCamera

Get Kinect's video camera.

The method simply creates instance of the KinectVideoCamera class by calling its appropriate constructor. Use KinectVideoCamera.Start method to start the video then.

SetLedColor ( LedColorOption ledColor ) : void

Set color of Kinect's LED.

SetMotorTilt ( int angle ) : void

Set motor's tilt value.

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

Метод Описание
AddFailureHandler ( int deviceID, DeviceFailureHandler handler ) : void
CheckDevice ( ) : void
Dispose ( bool disposing ) : void
IsDeviceFailed ( int deviceID ) : bool
Kinect ( IntPtr rawDevice, int deviceID ) : System
KinectStatusThread ( ) : void
Kinect_OnError ( IntPtr device ) : void
StartStatusThread ( ) : void
StopStatusThread ( ) : void

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

Dispose() публичный Метод

Dispose device freeing all associated unmanaged resources.
public Dispose ( ) : void
Результат void

GetAccelerometerValues() публичный Метод

Get accelerometer values for 3 axes.

Units of all 3 values are m/s2. The g value used for calculations is taken as 9.80665 m/s2.

public GetAccelerometerValues ( double &x, double &y, double &z ) : void
x double X axis value on the accelerometer.
y double Y axis value on the accelerometer.
z double Z axis value on the accelerometer.
Результат void

GetDepthCamera() публичный Метод

Get Kinect's depth camera.

The method simply creates instance of the KinectDepthCamera class by calling its appropriate constructor. Use KinectDepthCamera.Start method to start the video then.

public GetDepthCamera ( ) : KinectDepthCamera
Результат KinectDepthCamera

GetDevice() публичный статический Метод

Get initialized instance of the Kinect device.
There is no Kinect device with specified ID connected to the system. Failed connecting to the Kinect device specified ID.
public static GetDevice ( int deviceID ) : Kinect
deviceID int ID of the Kinect device to get instance of, [0, ),
Результат Kinect

GetVideoCamera() публичный Метод

Get Kinect's video camera.

The method simply creates instance of the KinectVideoCamera class by calling its appropriate constructor. Use KinectVideoCamera.Start method to start the video then.

public GetVideoCamera ( ) : KinectVideoCamera
Результат KinectVideoCamera

SetLedColor() публичный Метод

Set color of Kinect's LED.
Some error occurred with the device. Check error message.
public SetLedColor ( LedColorOption ledColor ) : void
ledColor LedColorOption LED color to set.
Результат void

SetMotorTilt() публичный Метод

Set motor's tilt value.
Motor tilt has to be in the [-31, 31] range. Some error occurred with the device. Check error message.
public SetMotorTilt ( int angle ) : void
angle int Tilt value to set, [-31, 30] degrees.
Результат void